Skip to content

Commit

Permalink
Optimize AdaptiveRadixTree (#4640)
Browse files Browse the repository at this point in the history
* Optimize `AdaptiveRadixTree`

Benchmark results:

```
Benchmark                                                      Mode  Cnt         Score   Error   Units
JavaTypeCacheBenchmark.readAdaptiveRadix                      thrpt    2       609.359           ops/s
JavaTypeCacheBenchmark.readAdaptiveRadix:gc.alloc.rate        thrpt    2      1814.269          MB/sec
JavaTypeCacheBenchmark.readAdaptiveRadix:gc.alloc.rate.norm   thrpt    2   3122809.369            B/op
JavaTypeCacheBenchmark.readAdaptiveRadix:gc.count             thrpt    2       169.000          counts
JavaTypeCacheBenchmark.readAdaptiveRadix:gc.time              thrpt    2        61.000              ms
JavaTypeCacheBenchmark.readSnappy                             thrpt    2       332.215           ops/s
JavaTypeCacheBenchmark.readSnappy:gc.alloc.rate               thrpt    2      3192.919          MB/sec
JavaTypeCacheBenchmark.readSnappy:gc.alloc.rate.norm          thrpt    2  10082058.492            B/op
JavaTypeCacheBenchmark.readSnappy:gc.count                    thrpt    2       179.000          counts
JavaTypeCacheBenchmark.readSnappy:gc.time                     thrpt    2        78.000              ms
JavaTypeCacheBenchmark.writeAdaptiveRadix                     thrpt    2       469.081           ops/s
JavaTypeCacheBenchmark.writeAdaptiveRadix:gc.alloc.rate       thrpt    2      4802.820          MB/sec
JavaTypeCacheBenchmark.writeAdaptiveRadix:gc.alloc.rate.norm  thrpt    2  10738906.909            B/op
JavaTypeCacheBenchmark.writeAdaptiveRadix:gc.count            thrpt    2       197.000          counts
JavaTypeCacheBenchmark.writeAdaptiveRadix:gc.time             thrpt    2       256.000              ms
JavaTypeCacheBenchmark.writeSnappy                            thrpt    2       313.278           ops/s
JavaTypeCacheBenchmark.writeSnappy:gc.alloc.rate              thrpt    2      3414.677          MB/sec
JavaTypeCacheBenchmark.writeSnappy:gc.alloc.rate.norm         thrpt    2  11435420.340            B/op
JavaTypeCacheBenchmark.writeSnappy:gc.count                   thrpt    2       133.000          counts
JavaTypeCacheBenchmark.writeSnappy:gc.time                    thrpt    2       174.000              ms
```

Additionally, here is the memory footprint for the two implementations:

```
Retained AdaptiveRadixTree size:    8425616 bytes
Retained Snappy size:               8613760 bytes
```

* Use UTF-8 encoding

* More micro-optimizations

* Allow search and insert with byte[]

* Allow search and insert with byte[]

* More small optimizations

* More small optimizations

* Remove control flow exception

* Remove control flow exception

* Final touches

* Missing newline
  • Loading branch information
knutwannheden authored Nov 2, 2024
1 parent 40bc734 commit dd287a2
Show file tree
Hide file tree
Showing 2 changed files with 532 additions and 691 deletions.
Loading

0 comments on commit dd287a2

Please sign in to comment.