kpumuk opened a new pull request, #3722:
URL: https://github.com/apache/thrift/pull/3722

   <!-- Explain the changes in the pull request below: -->
   
   Enable `Style/UnpackFirst` and replace single-value `unpack(...).first` and 
parallel-assignment unpacking with `unpack1` throughout the Ruby library and 
tests. Binary protocol i16 and i32 reads now avoid an intermediate array 
alongside double reads and UUID byte decoding.
   
   ## Benchmarks
   
   The repository protocol benchmark compared `upstream/master` with this 
branch in `thrift-2ebf` using Ruby 4.0.6 on aarch64 Linux. Each result is the 
median of seven isolated invocations; every invocation includes the harness 
warm-up pass.
   
   ```text
   THRIFT_BENCHMARK_SKIP_NATIVE=1 ruby test/rb/benchmarks/protocol_benchmark.rb 
\
     --json \
     --large-runs 3 \
     --small-runs 20000 \
     --scenarios 
rb-bin-read-large,rb-cmp-read-large,rb-bin-read-small,rb-cmp-read-small,hdr-bin-read-small,hdr-cmp-read-small,hdr-zlib-read-small
   ```
   
   | Read scenario | `upstream/master` | This branch | Change |
   | --- | ---: | ---: | ---: |
   | Ruby binary, three large structures | 1.3304 s | 1.2904 s | -3.0% |
   | Ruby compact, three large structures | 1.2256 s | 1.2251 s | -0.04% |
   | Ruby binary, 20,000 small structures | 0.3874 s | 0.3704 s | -4.4% |
   | Ruby compact, 20,000 small structures | 0.3578 s | 0.3531 s | -1.3% |
   | Header binary, 20,000 small structures | 0.6312 s | 0.5973 s | -5.4% |
   | Header compact, 20,000 small structures | 0.6115 s | 0.5965 s | -2.4% |
   | Header zlib, 20,000 small structures | 0.7031 s | 0.6749 s | -4.0% |
   
   A separate stdlib-only primitive benchmark measured 500,000 operations in 
isolated processes with GC disabled. Each replacement removed one allocation 
per operation and reduced retained memory:
   
   | Operation | Allocations/op | Retained RSS |
   | --- | ---: | ---: |
   | double (`G`) | 2 → 1 | 38.7 → 19.1 MiB |
   | UUID hex (`H*`) | 3 → 2 | 77.6 → 57.9 MiB |
   | i16 (`n`) | 2 → 1 | 38.7 → 19.1 MiB |
   | i32 (`N`) | 2 → 1 | 38.8 → 19.1 MiB |
   
   The protocol benchmark measures only the selected pure-Ruby read scenarios, 
while the primitive benchmark isolates unpacking allocation cost; neither 
predicts complete application throughput.
   
   
   <!-- We recommend you review the checklist/tips before submitting a pull 
request. -->
   
   - [ ] Did you create an [Apache 
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  
([Request account here](https://selfserve.apache.org/jira-account.html), not 
required for trivial changes)
   - [ ] If a ticket exists: Does your pull request title follow the pattern 
"THRIFT-NNNN: describe my issue"?
   - [x] Did you squash your changes to a single commit?  (not required, but 
preferred)
   - [x] Did you do your best to avoid breaking changes?  If one was needed, 
did you label the Jira ticket with "Breaking-Change"?
   - [ ] If your change does not involve any code, include `[skip ci]` anywhere 
in the commit message to free up build resources.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


-- 
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]

Reply via email to