proost opened a new pull request, #177:
URL: https://github.com/apache/datasketches-go/pull/177
Current "GetFrequentItems" returned slice of pointers. It makes large heap
allocations and finally this lead to huge GC overhead.
I propose use value type instead.
Here is benchmark:
```
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkSortItems_Row_Pointer
BenchmarkSortItems_Row_Pointer/size=10
BenchmarkSortItems_Row_Pointer/size=10-12 4225843
276.6 ns/op 568 B/op 15 allocs/op
BenchmarkSortItems_Row_Pointer/size=100
BenchmarkSortItems_Row_Pointer/size=100-12 370392
2956 ns/op 5368 B/op 108 allocs/op
BenchmarkSortItems_Row_Pointer/size=1000
BenchmarkSortItems_Row_Pointer/size=1000-12 34378
33689 ns/op 49528 B/op 1011 allocs/op
BenchmarkSortItems_Row_Pointer/size=10000
BenchmarkSortItems_Row_Pointer/size=10000-12 2156
518306 ns/op 630392 B/op 10018 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkSortItems_Row_Value
BenchmarkSortItems_Row_Value/size=10
BenchmarkSortItems_Row_Value/size=10-12 8494632
124.3 ns/op 320 B/op 1 allocs/op
BenchmarkSortItems_Row_Value/size=100
BenchmarkSortItems_Row_Value/size=100-12 574056
1867 ns/op 3200 B/op 1 allocs/op
BenchmarkSortItems_Row_Value/size=1000
BenchmarkSortItems_Row_Value/size=1000-12 56760
20631 ns/op 32768 B/op 1 allocs/op
BenchmarkSortItems_Row_Value/size=10000
BenchmarkSortItems_Row_Value/size=10000-12 2941
355211 ns/op 327680 B/op 1 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkSortItems_RowItem_Pointer
BenchmarkSortItems_RowItem_Pointer/size=10
BenchmarkSortItems_RowItem_Pointer/size=10-12 3026780
390.7 ns/op 728 B/op 15 allocs/op
BenchmarkSortItems_RowItem_Pointer/size=100
BenchmarkSortItems_RowItem_Pointer/size=100-12 268033
4498 ns/op 6968 B/op 108 allocs/op
BenchmarkSortItems_RowItem_Pointer/size=1000
BenchmarkSortItems_RowItem_Pointer/size=1000-12 23358
50842 ns/op 65528 B/op 1011 allocs/op
BenchmarkSortItems_RowItem_Pointer/size=10000
BenchmarkSortItems_RowItem_Pointer/size=10000-12 1527
758682 ns/op 790403 B/op 10018 allocs/op
PASS
goos: darwin
goarch: arm64
pkg: github.com/apache/datasketches-go/frequencies
cpu: Apple M4 Pro
BenchmarkSortItems_RowItem_Value
BenchmarkSortItems_RowItem_Value/size=10
BenchmarkSortItems_RowItem_Value/size=10-12 4171860
274.2 ns/op 416 B/op 1 allocs/op
BenchmarkSortItems_RowItem_Value/size=100
BenchmarkSortItems_RowItem_Value/size=100-12 326707
3848 ns/op 4096 B/op 1 allocs/op
BenchmarkSortItems_RowItem_Value/size=1000
BenchmarkSortItems_RowItem_Value/size=1000-12 27349
43786 ns/op 40960 B/op 1 allocs/op
BenchmarkSortItems_RowItem_Value/size=10000
BenchmarkSortItems_RowItem_Value/size=10000-12 1557
719896 ns/op 401409 B/op 1 allocs/op
PASS
```
Problem is this is BREAKING CHANGE. But acceptable.
1. this project is under development.
2. Users can't aware changes. Because usually use with "for" loop. So it
doesn't change any for loop logic. And all fields is private. Either pointer
type or value type, user can access using Getter only.
--
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]