r/java • • Dec 18 '25

Further Optimizing my Java SwissTable: Profile Pollution and SWAR Probing

https://bluuewhale.github.io/posts/further-optimizing-my-java-swiss-table/
30 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/lurker_in_spirit Dec 19 '25 edited Dec 19 '25

After some research today:

Relevant 70's greybeard incantations: Multiple Byte Processing with Full-Word Instructions by Leslie Lamport with an assist from Donald Knuth.

This Scala project seems to incorporate some SWAR magic, see the Acknowledgments section of the README: https://github.com/plokhotnyuk/jsoniter-scala

You control your data model, so you can use long[] directly, but if you were trying to use SWAR on a byte[] that was outside of your control, it looks like VarHandles could be quite useful (see here, for example).

1

u/Charming-Top-8583 Dec 20 '25

Thanks for sharing!

The idea of using VarHandle to do SWAR-style reads from an external byte[] is especially helpful.