You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit removes the internal buffering in CodedOutputStream. The protobuf
library should rely on the application to provide a buffered Write
implementation, if it so desires. By buffering internally, the protobuf library
forces double buffering in situations where the application is already buffering.
Additionally, it forces awkward resource lifetime issues as discussed in stepancheg#147.
Removing the internal buffering simplifies the internals of CodedOutputStream
and improves performance on the rust-protobuf-perftest write tests.
Before:
test1: write: 86 ns per iter
test_repeated_bool: write: 91 ns per iter
test_repeated_packed_int32: write: 127 ns per iter
test_repeated_messages: write: 224 ns per iter
test_optional_messages: write: 202 ns per iter
test_strings: write: 136 ns per iter
test_small_bytearrays: write: 1098 ns per iter
test_large_bytearrays: write: 119221 ns per iter
After:
test1: write: 55 ns per iter
test_repeated_bool: write: 66 ns per iter
test_repeated_packed_int32: write: 122 ns per iter
test_repeated_messages: write: 248 ns per iter
test_optional_messages: write: 207 ns per iter
test_strings: write: 118 ns per iter
test_small_bytearrays: write: 1064 ns per iter
test_large_bytearrays: write: 109567 ns per iter
0 commit comments