diff options
author | Andrew Morrow <acm@10gen.com> | 2013-12-22 10:49:36 -0500 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2014-01-04 14:55:32 -0500 |
commit | 344b86426595713e32fefa2e5a627988b04529fb (patch) | |
tree | f3b55a41393fa2d179ce19860a983553304a4166 /src/mongo/db/field_ref.h | |
parent | 7829e62e06559b75c6121e0486d4f1769f4dbfa6 (diff) | |
download | mongo-344b86426595713e32fefa2e5a627988b04529fb.tar.gz |
SERVER-10159 Store the FieldRef for _id in a file static to avoid a dynamic allocation
Diffstat (limited to 'src/mongo/db/field_ref.h')
-rw-r--r-- | src/mongo/db/field_ref.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/field_ref.h b/src/mongo/db/field_ref.h index 6f68f019126..d35a94d284d 100644 --- a/src/mongo/db/field_ref.h +++ b/src/mongo/db/field_ref.h @@ -51,7 +51,9 @@ namespace mongo { class FieldRef { MONGO_DISALLOW_COPYING(FieldRef); public: - FieldRef() : _size(0) {} + FieldRef(); + + explicit FieldRef(const StringData& path); /** * Field parts accessed through getPart() calls no longer would be valid, after the @@ -126,6 +128,11 @@ namespace mongo { // with allocations. static const size_t kReserveAhead = 4; + /** + * Parses 'path' into parts. + */ + void _parse(const StringData& path); + /** Converts the field part index to the variable part equivalent */ size_t getIndex(size_t i) const { return i-kReserveAhead; } |