You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@datasketches.apache.org by "Fengzdadi (via GitHub)" <gi...@apache.org> on 2026/01/02 05:22:43 UTC

[PR] perf: optimize coupon list deserialization by pre-computing offset [datasketches-go]

Fengzdadi opened a new pull request, #87:
URL: https://github.com/apache/datasketches-go/pull/87

   ## Summary
   
   Minor optimization to `deserializeCouponList()` in `hll/coupon_list.go` - pre-compute the offset instead of calculating `listIntArrStart + it*4` in each iteration.
   
   ## Related Issue
   
   Closes #86 
   
   ## Changes
   
   ```diff
   - for it := 0; it < couponCount; it++ {
   -     list.couponIntArr[it] = int(binary.LittleEndian.Uint32(byteArray[listIntArrStart+it*4 : listIntArrStart+it*4+4]))
   - }
   + base := listIntArrStart
   + for it := 0; it < couponCount; it++ {
   +     list.couponIntArr[it] = int(binary.LittleEndian.Uint32(byteArray[base:]))
   +     base += 4
   + }
   ```
   
   ## Benchmark Results
   
   | Method | 8 items | 32 items | 128 items | 1024 items |
   |--------|---------|----------|-----------|------------|
   | Before | 27.6 ns | 75.4 ns | 270 ns | 2153 ns |
   | After | 26.8 ns | 69.9 ns | 253 ns | 2000 ns |
   
   ~7% improvement by replacing multiplication with addition per iteration.
   
   ## Testing
   
   All existing tests pass:
   ```
   go test ./hll/
   ```
   


-- 
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: dev-unsubscribe@datasketches.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@datasketches.apache.org
For additional commands, e-mail: dev-help@datasketches.apache.org


Re: [PR] perf: optimize coupon list deserialization by pre-computing offset [datasketches-go]

Posted by "freakyzoidberg (via GitHub)" <gi...@apache.org>.
freakyzoidberg merged PR #87:
URL: https://github.com/apache/datasketches-go/pull/87


-- 
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: dev-unsubscribe@datasketches.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@datasketches.apache.org
For additional commands, e-mail: dev-help@datasketches.apache.org