Hazenix opened a new pull request, #3842:
URL: https://github.com/apache/dubbo-go/pull/3842

   Refs #3728 (Triple non-IDL codec reuse).
   
   ## Summary
   
   The built-in Triple MsgPack codec created a default `MsgpackHandle` for 
every encode and decode. Reusing the handle keeps the type cache available 
across calls.
   
   ```diff
   - Encode or decode with a fresh default MsgpackHandle
   + Encode or decode with a shared default MsgpackHandle
     Keep a separate Encoder or Decoder for each call
   ```
   
   ## Evidence
   
   Ran `BenchmarkWrapperCodecFastPath` and `BenchmarkWrapperCodecSlowPath` on 
Apple M4 Pro with Go 1.25.0 and one benchmark CPU. The measurements are medians 
from six alternating before/after runs. All 16 MsgPack cases saved four 
allocations per operation. Across the 128 B and 1 KiB cases, median time fell 
by 7.0%–19.5%.
   
   | FastPath case | ns/op | B/op | allocs/op |
   |---|---:|---:|---:|
   | 128 B Triple | 511 → 416 | 1,648 → 1,392 | 10 → 6 |
   | 128 B Envelope | 520 → 425 | 1,653 → 1,397 | 11 → 7 |
   | 1 KiB Triple | 760 → 668 | 3,184 → 2,928 | 11 → 7 |
   | 1 KiB Envelope | 765 → 681 | 3,189 → 2,933 | 12 → 8 |
   
   In a ten-pair follow-up, 16 KiB Envelope SlowPath was 9.1% faster at the 
median. The 1 MiB Envelope FastPath median moved by +0.6%, with five faster and 
five slower pairs. These benchmarks measure wrapper encoding and framing on the 
send path.
   
   - The new regression compares request and response wrapper bytes against a 
fresh-handle encoder and decodes the old bytes on both sides. Sixteen parallel 
round trips passed twenty repeated runs under `-race`.
   - `go test -race ./protocol/triple/... -count=1` and the external codec 
plugin RPC regression tests passed.
   
   ## Merge Danger
   
   Reversible with a single revert. The change is scoped to the built-in Triple 
MsgPack codec. Its default options and per-call encoder and decoder ownership 
are preserved.
   
   ### Checklist
   
   - [x] I confirm the target branch is `develop`
   - [ ] I have run `make fmt` to format my code
   - [ ] I have run `make test` to run local tests
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] perf: reuse the Tr... Hazenix (via GitHub) via notifications

Reply via email to