Skip to content

Conversation

@zongyao8752593
Copy link

Instead of storing result to memory at each byte iteration, we can keep temp result in a register and only write to memory once at the end. This reduces unnecessary memory stores and improves performance.

Benchmark result without this patch:

[...]hrift/lib/cpp2/test/ProtocolBench.cpp relative time/iter iters/s

CompactProtocol_read_BigListBigInt 34.46us 29.02K

Benchmark result with this patch:

[...]hrift/lib/cpp2/test/ProtocolBench.cpp relative time/iter iters/s

CompactProtocol_read_BigListBigInt 30.21us 33.10K

Performance is uplifted by 14%.

Instead of storing result to memory at each byte iteration, we can keep
temp result in a register and only write to memory once at the end.
This reduces unnecessary memory stores and improves performance.

Benchmark result without this patch:
============================================================================
[...]hrift/lib/cpp2/test/ProtocolBench.cpp     relative  time/iter   iters/s
============================================================================
CompactProtocol_read_BigListBigInt                         34.46us    29.02K

Benchmark result with this patch:
============================================================================
[...]hrift/lib/cpp2/test/ProtocolBench.cpp     relative  time/iter   iters/s
============================================================================
CompactProtocol_read_BigListBigInt                         30.21us    33.10K

Performance is uplifted by 14%.
@meta-cla meta-cla bot added the CLA Signed label Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant