-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.5.6
-
Component/s: Internal Client
-
None
-
Environment:all
BSONArrayBuilder::fill is declared as follows:
void fill( const StringData& name )
{ char *r; int n = strtol( name.data(), &r, 10 ); uassert( 13048, (string)"can't append to array using string field name [" + name.data() + "]" , !*r ); while( _i < n ) append( nullElt() ); }That 'uassert' call ends up constructing a temporary string, appending to it, and then passing it by value to uassert, all to determine that r is not NULL in the vast majority of cases. From what i can tell in bson.h, the uassert call is not conditional on a debug build, or something similar.
Removing the uassert dramatically improves the performance of adding elements to a BSON array.