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

   During Serialization, temporary allocations happens due to collecting active 
values and active keys.
   
   But we can remove those allocations and reduce 4 loops to one.
   
   
   main branch:
   
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/datasketches-go/frequencies
   cpu: Apple M4 Pro
   BenchmarkLongsSketchToSlice
   BenchmarkLongsSketchToSlice/active=48
   BenchmarkLongsSketchToSlice/active=48-12              4521978               
262.5 ns/op          1664 B/op          3 allocs/op
   BenchmarkLongsSketchToSlice/active=768
   BenchmarkLongsSketchToSlice/active=768-12              344616              
3540 ns/op           25856 B/op          3 allocs/op
   BenchmarkLongsSketchToSlice/active=12288
   BenchmarkLongsSketchToSlice/active=12288-12             20967             
56307 ns/op          401410 B/op          3 allocs/op
   BenchmarkLongsSketchToSlice/active=196608
   BenchmarkLongsSketchToSlice/active=196608-12             1006           
1112128 ns/op         6299650 B/op          3 allocs/op
   PASS
   ```
   
   This PR:
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/datasketches-go/frequencies
   cpu: Apple M4 Pro
   BenchmarkLongsSketchToSlice
   BenchmarkLongsSketchToSlice/active=48
   BenchmarkLongsSketchToSlice/active=48-12              9544124               
126.4 ns/op           896 B/op          1 allocs/op
   BenchmarkLongsSketchToSlice/active=768
   BenchmarkLongsSketchToSlice/active=768-12              701419              
1667 ns/op           13568 B/op          1 allocs/op
   BenchmarkLongsSketchToSlice/active=12288
   BenchmarkLongsSketchToSlice/active=12288-12             38566             
31243 ns/op          204803 B/op          1 allocs/op
   BenchmarkLongsSketchToSlice/active=196608
   BenchmarkLongsSketchToSlice/active=196608-12             2101            
559105 ns/op         3153921 B/op          1 allocs/op
   PASS
   ```


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

Reply via email to