ruby-protobuf / protobuf

A pure ruby implementation of Google's Protocol Buffers
https://github.com/ruby-protobuf
MIT License
463 stars 101 forks source link

only fetch value once on serialization and cache the varint encoding … #286

Closed abrandoned closed 8 years ago

abrandoned commented 8 years ago

…for most common cases (< 1024)

adding a cache of varint fields for any varint < 1024 for now (may make configurable in the future), runs it on load and uses the cached values instead of calculating

https://gist.github.com/abrandoned/044cf200037ff7885572

about 100% increase in encoding time of varints under jruby when varint is > 128; < 128 10%