DomGarguilo commented on issue #2812: URL: https://github.com/apache/accumulo/issues/2812#issuecomment-1199839457
I ended up making a github repository for benchmarking various versions of `Key.equals()`. The repo can be found at https://github.com/DomGarguilo/key-equals-benchmark Some of the results I got from running the benchmark: ``` With random PartialKey Benchmark Mode Cnt Score Error Units MyBenchmark.customVanilla thrpt 25 27.139 ± 0.286 ops/s MyBenchmark.customVanilla2 thrpt 25 28.130 ± 0.182 ops/s MyBenchmark.refactoredEquals thrpt 25 27.282 ± 0.096 ops/s With deepest PartialKey only (ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL) Benchmark Mode Cnt Score Error Units MyBenchmark.customVanilla thrpt 25 47.726 ± 0.422 ops/s MyBenchmark.customVanilla2 thrpt 25 74.062 ± 0.438 ops/s MyBenchmark.refactoredEquals thrpt 25 53.445 ± 0.557 ops/s ``` The run in the benchmark can be viewed [here](https://github.com/DomGarguilo/key-equals-benchmark/blob/9a9dc99d13820e62575dfcfa488309b4d9af610e/src/main/java/org/sample/WillKey.java#L34). `customVanilla` - copied over the code for `Key.equals()` `customVanilla2` - same as current equals function just the delete and timestamp are evaluated first for the `PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL` case (as suggested by @EdColeman in [a comment above](https://github.com/apache/accumulo/issues/2812#issuecomment-1188111321)) `refactoredEquals` - refactored to reuse code and make the method smaller It is probably important to take note of [how the data is being produced](https://github.com/DomGarguilo/key-equals-benchmark/blob/9a9dc99d13820e62575dfcfa488309b4d9af610e/src/main/java/org/sample/MyBenchmark.java#L52) and other factors before drawing any conclusions here. From the results above it seems like both of the other versions of this method are (potentially negligibly) more performant than the current code. The `refactoredEquals` method also has the advantage of not being "hot" (elaborated [here](https://github.com/apache/accumulo/pull/2811#issuecomment-1198615354)). I think I need some input on these benchmarks and their findings to determine if anything significant can be drawn from them. Specifically, how the data in the benchmark is being produced and the structure of the benchmark in general. -- 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]
