summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonobjbuilder.cpp
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2020-03-05 12:59:37 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-09 23:20:55 +0000
commit4994a4809269c30a28cdbb686c8c876fad7b163a (patch)
tree0e6a62253edbf6449eb85d6b6783ee0211d00e63 /src/mongo/bson/bsonobjbuilder.cpp
parent83b4367daba1395aaf09f157db7edff3b2fd7431 (diff)
downloadmongo-4994a4809269c30a28cdbb686c8c876fad7b163a.tar.gz
SERVER-44095 Initialize TypeBits buffer to a smaller size
This lowers the memory overhead of index key generation by reducing the initial buffer size in TypeBits from 512 to 8 bytes.
Diffstat (limited to 'src/mongo/bson/bsonobjbuilder.cpp')
-rw-r--r--src/mongo/bson/bsonobjbuilder.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/mongo/bson/bsonobjbuilder.cpp b/src/mongo/bson/bsonobjbuilder.cpp
index 1eab3f0b93c..39538ecf6c5 100644
--- a/src/mongo/bson/bsonobjbuilder.cpp
+++ b/src/mongo/bson/bsonobjbuilder.cpp
@@ -235,25 +235,9 @@ BSONObjBuilder::~BSONObjBuilder() {
}
}
-template <typename Alloc>
-void BasicBufBuilder<Alloc>::grow_reallocate(int minSize) {
- if (minSize > BufferMaxSize) {
- std::stringstream ss;
- ss << "BufBuilder attempted to grow() to " << minSize << " bytes, past the 64MB limit.";
- msgasserted(13548, ss.str().c_str());
- }
-
- int a = 64;
- while (a < minSize)
- a = a * 2;
-
- _buf.realloc(a);
- size = a;
-}
-
template class BasicBufBuilder<SharedBufferAllocator>;
-template class BasicBufBuilder<StackAllocator>;
+template class BasicBufBuilder<StackAllocator<StackSizeDefault>>;
template class StringBuilderImpl<SharedBufferAllocator>;
-template class StringBuilderImpl<StackAllocator>;
+template class StringBuilderImpl<StackAllocator<StackSizeDefault>>;
} // namespace mongo