• Wouter van Oortmerssen's avatar
    Reduced FlatBufferBuilder from 3 buffers to 1 · 79b80f84
    Wouter van Oortmerssen authored
    Previously, FlatBufferBuilder used 3 resizable buffers:
    - serialization (vector_downward)
    - field offsets (std::vector)
    - vtable offsets (std::vector)
    
    Since the serialization buffer grows downwards, the bottom part of
    it can be used as a "scratchpad" storage for the other two. Since
    field offsets are only accumulated during table construction, and
    vtable offsets only after table construction, the two can trivially
    share the same storage.
    
    Not only does this reduce the amount of allocation, it also removes
    the bulk of std::vector usage from FlatBufferBuilder which was
    the #1 cause of slow-down in debug mode, see e.g.:
    https://stackoverflow.com/questions/36085285/any-way-to-improve-flatbuffer-performance-in-debug-c-msvc
    
    Change-Id: I0224cf2f2a863d2d7ef762bc9163b52fdc149522
    Tested: on Linux.
    79b80f84
Name
Last commit
Last update
.github Loading commit data...
.travis Loading commit data...
CMake Loading commit data...
android Loading commit data...
biicode Loading commit data...
docs Loading commit data...
go Loading commit data...
grpc Loading commit data...
include/flatbuffers Loading commit data...
java/com/google/flatbuffers Loading commit data...
js Loading commit data...
net/FlatBuffers Loading commit data...
php Loading commit data...
python Loading commit data...
reflection Loading commit data...
samples Loading commit data...
src Loading commit data...
tests Loading commit data...
.clang-format Loading commit data...
.editorconfig Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CMakeLists.txt Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE.txt Loading commit data...
appveyor.yml Loading commit data...
biicode.conf Loading commit data...
composer.json Loading commit data...
package.json Loading commit data...
pom.xml Loading commit data...
readme.md Loading commit data...