diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-03-09 10:02:02 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-13 14:36:35 +0000 |
commit | 5094b4f2f2ee9de07dc4c3d3c320e967595496f1 (patch) | |
tree | ee5aacbd54e4b8454067bfafe0fbd7c604439c9a /src/mongo/bson/bsonobj.cpp | |
parent | 8c028c6959290710de551359fb296f655584d43f (diff) | |
download | mongo-5094b4f2f2ee9de07dc4c3d3c320e967595496f1.tar.gz |
SERVER-46406 Perf improvements in the logger.
Use fmt::compile and fmt::format_int when possible.
Diffstat (limited to 'src/mongo/bson/bsonobj.cpp')
-rw-r--r-- | src/mongo/bson/bsonobj.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonobj.cpp b/src/mongo/bson/bsonobj.cpp index 284058feecf..4cccfa89d8e 100644 --- a/src/mongo/bson/bsonobj.cpp +++ b/src/mongo/bson/bsonobj.cpp @@ -183,7 +183,8 @@ BSONObj BSONObj::_jsonStringGenerator(const Generator& g, fmt::memory_buffer& buffer, size_t writeLimit) const { if (isEmpty()) { - fmt::format_to(buffer, "{}", isArray ? "[]" : "{}"); + const auto empty = isArray ? "[]"_sd : "{}"_sd; + buffer.append(empty.rawData(), empty.rawData() + empty.size()); return BSONObj(); } buffer.push_back(isArray ? '[' : '{'); @@ -259,7 +260,7 @@ BSONObj BSONObj::jsonStringBuffer(JsonStringFormat format, if (format == ExtendedCanonicalV2_0_0) { return withGenerator(ExtendedCanonicalV200Generator()); } else if (format == ExtendedRelaxedV2_0_0) { - return withGenerator(ExtendedRelaxedV200Generator()); + return withGenerator(ExtendedRelaxedV200Generator(dateFormatIsLocalTimezone())); } else if (format == LegacyStrict) { return withGenerator(LegacyStrictGenerator()); } else { |