kpumuk commented on code in PR #3745:
URL: https://github.com/apache/thrift/pull/3745#discussion_r3840284800
##########
lib/rb/lib/thrift/protocol/compact_protocol.rb:
##########
@@ -397,15 +397,16 @@ def read_byte
end
def read_i16
- zig_zag_to_int(read_varint32)
+ value = zig_zag_to_int(read_varint32) & 0xffff
+ value > I16_MAX ? value - (2**16) : value
Review Comment:
Changed this to `0x10000`. Ruby 4.0.6 bytecode emits a `:**` call for
`2**16` on every negative i16 decode, while the literal is loaded directly. A
focused 5,000,000-iteration benchmark measured 94.9 ns/call with exponentiation
and 77.7 ns/call with the literal. Native and pure Compact specs remain green.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]