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

   <!-- Explain the changes in the pull request below: -->
   
   Ruby `Serializer` reads its backing memory buffer immediately after writing 
a value through the selected protocol. That produces the expected bytes for 
protocols writing directly to `MemoryBufferTransport`, but transports such as 
Header and Framed retain their output until they are flushed. In those 
configurations, serialization succeeds while returning an empty string.
   
   This change finalizes the transport exposed by the selected protocol before 
reading the serializer buffer. It relies on the existing transport contract: 
flushing a memory buffer remains a no-op, while buffering and framing 
transports complete their wire representation. The behavior therefore remains 
generic instead of coupling `Serializer` to specific protocol or transport 
classes.
   
   ## Benchmarks
   
   A targeted benchmark ran 50,000 ordinary serializer calls per protocol for 
five trials with:
   
   ```text
   bundle exec ruby -Ilib /tmp/serializer_benchmark.rb
   ```
   
   The benchmark compared current master with this change under the same Ruby 
container and workload. Medians in seconds were:
   
   | Mode | Protocol | Master | Proposed | Delta |
   |---|---|---:|---:|---:|
   | Native | Binary | 0.095683 | 0.095480 | -0.2% |
   | Native | Compact | 0.068843 | 0.067851 | -1.4% |
   | Native | JSON | 0.393388 | 0.392847 | -0.1% |
   | Pure Ruby | Binary | 0.130590 | 0.130288 | -0.2% |
   | Pure Ruby | Compact | 0.127151 | 0.128482 | +1.0% |
   | Pure Ruby | JSON | 0.470556 | 0.472781 | +0.5% |
   
   The small differences are within run-to-run noise. This benchmark targets 
the existing direct-memory paths, where the new call resolves to a no-op flush. 
It does not compare Header or Framed throughput because master returns no 
serialized bytes for those configurations.
     
   <!-- We recommend you review the checklist/tips before submitting a pull 
request. -->
   
   - [x] Did you create an [Apache 
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket? 
[THRIFT-6147](https://issues.apache.org/jira/browse/THRIFT-6147)
   - [x] 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