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.cpp | |
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.cpp')
-rw-r--r-- | src/mongo/db/field_ref.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/db/field_ref.cpp b/src/mongo/db/field_ref.cpp index 2e6ce7f3b0f..4d89695028d 100644 --- a/src/mongo/db/field_ref.cpp +++ b/src/mongo/db/field_ref.cpp @@ -35,8 +35,14 @@ namespace mongo { - void FieldRef::parse(const StringData& dottedField) { - if (dottedField.size() == 0) { + FieldRef::FieldRef() : _size(0) {} + + FieldRef::FieldRef(const StringData& path) : _size(0) { + parse(path); + } + + void FieldRef::parse(const StringData& path) { + if (path.size() == 0) { return; } @@ -47,7 +53,7 @@ namespace mongo { // We guarantee that accesses through getPart() will be valid while 'this' is. So we // keep a copy in a local sting. - _dotted = dottedField.toString(); + _dotted = path.toString(); // Separate the field parts using '.' as a delimiter. std::string::iterator beg = _dotted.begin(); |