Skip to content

Plugable bytereader#230

Closed
shawjef3 wants to merge 3 commits intomaxmind:mainfrom
shawjef3:jmh-plugable-bytereader
Closed

Plugable bytereader#230
shawjef3 wants to merge 3 commits intomaxmind:mainfrom
shawjef3:jmh-plugable-bytereader

Conversation

@shawjef3
Copy link

@shawjef3 shawjef3 commented Feb 8, 2025

This builds upon #228 and is for #229.

before

Benchmark                    Mode  Cnt     Score     Error  Units
BenchmarkGet.withCaching     avgt   10  1082.168 ±  57.571  ns/op
BenchmarkGet.withoutCaching  avgt   10  6272.534 ± 155.222  ns/op

after

Benchmark                    Mode  Cnt     Score    Error  Units
BenchmarkGet.withCaching     avgt   10  1037.877 ± 72.202  ns/op
BenchmarkGet.withoutCaching  avgt   10  4412.954 ± 75.050  ns/op

`bufferHolderReference` can be volatile instead of atomic, since operations like `getAndSet` aren't used.
@shawjef3 shawjef3 changed the title Jmh plugable bytereader Plugable bytereader Feb 8, 2025
@oschwald
Copy link
Member

I haven't gone through this PR line by line and I haven't tested it myself, but I am a bit confused about why it would be faster after the change. It appears that we are primarily adding an abstraction layer, ByteReader, around the ByteBuffer, adding some casts, and some addition bounds checks. Do you have a hypothesis about what would make it faster?

@shawjef3 shawjef3 closed this Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants