You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@datasketches.apache.org by "proost (via GitHub)" <gi...@apache.org> on 2026/09/05 08:29:21 UTC
[PR] perf: reduce temp allocation in deserialization [datasketches-go]
proost opened a new pull request, #179:
URL: https://github.com/apache/datasketches-go/pull/179
In deserialization, current temp allocation happens. we can reduce that.
And we can reduce two loops into one loop.
## ItemsSketch
main:
```
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkItemsSketchFromSlice
BenchmarkItemsSketchFromSlice/int64/items=48
BenchmarkItemsSketchFromSlice/int64/items=48-12 1298882 908.8 ns/op 880.28 MB/s 2096 B/op 7 allocs/op
BenchmarkItemsSketchFromSlice/int64/items=192
BenchmarkItemsSketchFromSlice/int64/items=192-12 327068 3683 ns/op 842.75 MB/s 7856 B/op 7 allocs/op
BenchmarkItemsSketchFromSlice/int64/items=768
BenchmarkItemsSketchFromSlice/int64/items=768-12 78704 15302 ns/op 805.14 MB/s 30896 B/op 7 allocs/op
BenchmarkItemsSketchFromSlice/string/items=48
BenchmarkItemsSketchFromSlice/string/items=48-12 770403 1510 ns/op 618.69 MB/s 3632 B/op 55 allocs/op
BenchmarkItemsSketchFromSlice/string/items=192
BenchmarkItemsSketchFromSlice/string/items=192-12 201334 6039 ns/op 622.92 MB/s 13872 B/op 199 allocs/op
BenchmarkItemsSketchFromSlice/string/items=768
BenchmarkItemsSketchFromSlice/string/items=768-12 48657 24591 ns/op 621.44 MB/s 54704 B/op 775 allocs/op
PASS
```
PR:
```
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkItemsSketchFromSlice
BenchmarkItemsSketchFromSlice/int64/items=48
BenchmarkItemsSketchFromSlice/int64/items=48-12 1419704 845.1 ns/op 946.62 MB/s 1712 B/op 6 allocs/op
BenchmarkItemsSketchFromSlice/int64/items=192
BenchmarkItemsSketchFromSlice/int64/items=192-12 342088 3459 ns/op 897.38 MB/s 6320 B/op 6 allocs/op
BenchmarkItemsSketchFromSlice/int64/items=768
BenchmarkItemsSketchFromSlice/int64/items=768-12 82773 14514 ns/op 848.81 MB/s 24752 B/op 6 allocs/op
BenchmarkItemsSketchFromSlice/string/items=48
BenchmarkItemsSketchFromSlice/string/items=48-12 803619 1447 ns/op 645.27 MB/s 3248 B/op 54 allocs/op
BenchmarkItemsSketchFromSlice/string/items=192
BenchmarkItemsSketchFromSlice/string/items=192-12 207325 5827 ns/op 645.62 MB/s 12336 B/op 198 allocs/op
BenchmarkItemsSketchFromSlice/string/items=768
BenchmarkItemsSketchFromSlice/string/items=768-12 50332 23517 ns/op 649.84 MB/s 48560 B/op 774 allocs/op
PASS
```
## LongsSketch
main:
```
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkLongsSketchFromSlice
BenchmarkLongsSketchFromSlice/items=48
BenchmarkLongsSketchFromSlice/items=48-12 2753096 429.0 ns/op 1864.97 MB/s 2064 B/op 7 allocs/op
BenchmarkLongsSketchFromSlice/items=192
BenchmarkLongsSketchFromSlice/items=192-12 774289 1511 ns/op 2053.71 MB/s 7824 B/op 7 allocs/op
BenchmarkLongsSketchFromSlice/items=768
BenchmarkLongsSketchFromSlice/items=768-12 208054 5727 ns/op 2151.25 MB/s 30864 B/op 7 allocs/op
PASS
```
PR:
```
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkLongsSketchFromSlice
BenchmarkLongsSketchFromSlice/items=48
BenchmarkLongsSketchFromSlice/items=48-12 3277532 352.7 ns/op 2268.47 MB/s 1296 B/op 5 allocs/op
BenchmarkLongsSketchFromSlice/items=192
BenchmarkLongsSketchFromSlice/items=192-12 978699 1265 ns/op 2453.94 MB/s 4752 B/op 5 allocs/op
BenchmarkLongsSketchFromSlice/items=768
BenchmarkLongsSketchFromSlice/items=768-12 247640 4888 ns/op 2520.38 MB/s 18576 B/op 5 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: 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: reduce temp allocation in deserialization [datasketches-go]
Posted by "proost (via GitHub)" <gi...@apache.org>.
proost merged PR #179:
URL: https://github.com/apache/datasketches-go/pull/179
--
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