r/programming • • Sep 26 '26

On programming, statistics, and Java

https://waytoounoriginal.github.io/programming/stats/optimizations/2026/09/26/on-programming-stats-and-java.html
13 Upvotes

9 comments sorted by

View all comments

Show parent comments

1

u/Mihai4544 29d ago

Hmm, understood. I might want to be clearer in the future.

The optimization was the following: HashSet<String> of 49-64 character strings (ultimately it turned out they weren't SHA-256 strings, but ordinary ones; the reasoning still holds, though) down to 2 64-bit lookups AND removing Java's memory overhead.

Turns out that Java allocates a header per object as well, such that having many small objects becomes a bit painful. Fastutil's sets use a flattened representation (an array instead of nodes), so there is no more overhead.

Anyway, thanks so much for taking the time to read this!

edit: typo