mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-04 22:11:12 +00:00
Keep the underlying storage capacity when clearing the FlatBufferBuilder. Gives a significant performance boost for serialisation of many small messages. (#7250)
This commit is contained in:
@@ -127,8 +127,8 @@ public struct FlatBufferBuilder {
|
|||||||
mutating public func clear() {
|
mutating public func clear() {
|
||||||
_minAlignment = 0
|
_minAlignment = 0
|
||||||
isNested = false
|
isNested = false
|
||||||
stringOffsetMap = [:]
|
stringOffsetMap.removeAll(keepingCapacity: true)
|
||||||
_vtables = []
|
_vtables.removeAll(keepingCapacity: true)
|
||||||
_vtableStorage.clear()
|
_vtableStorage.clear()
|
||||||
_bb.clear()
|
_bb.clear()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user