summaryrefslogtreecommitdiff
path: root/db/jsobj.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2011-04-01 17:35:11 -0400
committerMathias Stearn <mathias@10gen.com>2011-04-03 20:50:45 -0400
commit244b1621119d8291c73411bcc8b3d9d92bdda2fa (patch)
tree347b5429b748a392837ad9d5c1b46f9c081431fc /db/jsobj.cpp
parenta67334a28675ac44c15f99c7814d851152b0365a (diff)
downloadmongo-244b1621119d8291c73411bcc8b3d9d92bdda2fa.tar.gz
Use intrusive_ptr rather than shared_ptr for BSONObj
Advantages: * Owned BSONObj now uses 1 heap allocation rather than 3 * sizeof(BSONObj) is now 16 rather than 24 (on 64 bit) * perftest bson shows it to be much faster Change in BSONObj constructor API for owned case to make sure old code gets updated to allocate room for the ref count. Anyone using BSONObjBuilder doesn't need to worry about this change.
Diffstat (limited to 'db/jsobj.cpp')
-rw-r--r--db/jsobj.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/db/jsobj.cpp b/db/jsobj.cpp
index c761b947ed3..da4c44d00c7 100644
--- a/db/jsobj.cpp
+++ b/db/jsobj.cpp
@@ -897,8 +897,7 @@ namespace mongo {
}
if ( n ) {
- int len;
- init( b.decouple(len), true );
+ *this = b.obj();
}
return n;