Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster string serialization by optimising packInt #489

Conversation

batterseapower
Copy link
Contributor

We can avoid the loop and calling Integer.numberOfLeadingZeros very easily when writing small integers. This helps serialization of ASCII strings quite a bit.

@batterseapower
Copy link
Contributor Author

Travis build seems to be failing due to an OOM rather than an actual problem with this change?

@jankotek
Copy link
Owner

Travis builds are bit unstable, dont think this change is causing build error.

I am going to use this code, but STRING serializer will gets its long-pack method with this improvement.

@jankotek
Copy link
Owner

jankotek commented May 2, 2015

Nice, microbenchmarks shows it is almost 3x faster:

Benchmark                         Mode  Cnt         Score        Error  Units
StringReadWrite.writeUTF         thrpt  200   3862070.314 ± 114229.614  ops/s
StringReadWrite.writeUTFShorter  thrpt  200  11174539.297 ± 427621.738  ops/s

https://github.com/jankotek/mapdb-microbenchmarks/blob/master/src/main/java/org/mapdb/jmh/StringReadWrite.java

I merged bit modified version, but its now on by default.

@jankotek jankotek closed this in 27a398b May 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants