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

   previous PR: https://github.com/apache/datasketches-characterization/pull/89
   
   current go version theta sketch performance is bad. one of reasons using 
`errors.Is`. 
   
   generally, go recommends "errors.Is" for error check, but we are using 
sentinel error. So we can avoid using errors.Is.
   
   benchmark code:
   ```go
   func BenchmarkUpdateSketchErrorHandling(b *testing.B) {
        b.Run("UpdateInt64_NewKeys", func(b *testing.B) {
                sketch, _ := NewQuickSelectUpdateSketch()
                b.ResetTimer()
                for i := 0; i < b.N; i++ {
                        _ = sketch.UpdateInt64(int64(i))
                }
        })
   
        b.Run("UpdateInt64_DuplicateKeys", func(b *testing.B) {
                sketch, _ := NewQuickSelectUpdateSketch()
                _ = sketch.UpdateInt64(42)
                b.ResetTimer()
                for i := 0; i < b.N; i++ {
                        _ = sketch.UpdateInt64(42)
                }
        })
   }
   ```
   
   
   
   * Current UpdateSketch
   
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/datasketches-go/theta
   cpu: Apple M1 Pro
   BenchmarkUpdateSketchErrorHandling
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_NewKeys
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_NewKeys-10             
7506458               150.9 ns/op
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_DuplicateKeys
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_DuplicateKeys-10      
165562837                7.287 ns/op
   ```
   
   
   * New UpdateSketch
   
   ```
   BenchmarkUpdateSketchErrorHandling
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_NewKeys
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_NewKeys-10             
7503918               143.6 ns/op
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_DuplicateKeys
   BenchmarkUpdateSketchErrorHandling/UpdateInt64_DuplicateKeys-10      
166055470                7.227 ns/op
   ```
   
   benchmark code:
   ```go
   func BenchmarkUnionUpdate(b *testing.B) {
        b.Run("Update_NewKeys", func(b *testing.B) {
                sketches := make([]*QuickSelectUpdateSketch, b.N)
                for i := 0; i < b.N; i++ {
                        sketch, _ := NewQuickSelectUpdateSketch()
                        sketch.UpdateInt64(int64(i))
                        sketches[i] = sketch
                }
   
                union, _ := NewUnion()
                b.ResetTimer()
                for i := 0; i < b.N; i++ {
                        _ = union.Update(sketches[i])
                }
        })
   
        b.Run("Update_DuplicateKeys", func(b *testing.B) {
                sketches := make([]*QuickSelectUpdateSketch, b.N)
                for i := 0; i < b.N; i++ {
                        sketch, _ := NewQuickSelectUpdateSketch()
                        sketch.UpdateInt64(42)
                        sketches[i] = sketch
                }
   
                union, _ := NewUnion()
                b.ResetTimer()
                for i := 0; i < b.N; i++ {
                        _ = union.Update(sketches[i])
                }
        })
   }
   ```
   
   
   * Current Union Update
   
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/datasketches-go/theta
   cpu: Apple M1 Pro
   BenchmarkUnionUpdate
   BenchmarkUnionUpdate/Update_NewKeys
   BenchmarkUnionUpdate/Update_NewKeys-10                8556276               
457.7 ns/op
   BenchmarkUnionUpdate/Update_DuplicateKeys
   BenchmarkUnionUpdate/Update_DuplicateKeys-10          7176099               
443.6 ns/op
   ```
   
   
   * New Union Update
   
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/datasketches-go/theta
   cpu: Apple M1 Pro
   BenchmarkUnionUpdate
   BenchmarkUnionUpdate/Update_NewKeys
   BenchmarkUnionUpdate/Update_NewKeys-10                8699008               
430.7 ns/op
   BenchmarkUnionUpdate/Update_DuplicateKeys
   BenchmarkUnionUpdate/Update_DuplicateKeys-10          7546215               
292.6 ns/op
   ```


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