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

   We can reduce serialization twice to once.
   
   benchmark code: 
   
   ```
   func BenchmarkGetSerializedSizeBytes(b *testing.B) {
        comparator := common.ItemSketchStringComparator(false)
        serde := common.ItemSketchStringSerDe{}
        sketch, _ := NewKllItemsSketch[string](_DEFAULT_K, _DEFAULT_M, 
comparator, serde)
        for i := 0; i < 10000; i++ {
                sketch.Update(fmt.Sprintf("%05d", i))
        }
        b.ReportAllocs()
        b.ResetTimer()
        for i := 0; i < b.N; i++ {
                sketch.GetSerializedSizeBytes()
        }
   }
   ````
   
   AS-IS:
   
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/datasketches-go/kll
   cpu: Apple M4 Pro
   BenchmarkGetSerializedSizeBytes
   BenchmarkGetSerializedSizeBytes-12                  1        1372407375 
ns/op           32224 B/op        542 allocs/op
   PASS
   ```
   
   TO-BE:
   
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/datasketches-go/kll
   cpu: Apple M4 Pro
   BenchmarkGetSerializedSizeBytes
   BenchmarkGetSerializedSizeBytes-12            1000000              1003 
ns/op               0 B/op          0 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