|
There are a number of simple optimizations we can make to bsoncore.Document.String, bsoncore.Array.String, and bsoncore.Element.String that can significantly reduce allocations. Historically those haven't been a major concern, but the logging implementation (GODRIVER-1712) for command logging relies heavily on the bson.Raw.String function.
Definition of done:
- Replace all uses of bytes.Buffer with strings.Builder in bsoncore where the function output is a string.
- Remove all uses of fmt.Fprintf and fmt.Sprintf where there is little or no string formatting added.
- Add a benchmark that exercises bson.Raw.String for various inputs.
|