gunnarmorling / 1brc

1️⃣🐝🏎️ The One Billion Row Challenge -- A fun exploration of how quickly 1B rows from a text file can be aggregated with Java
https://www.morling.dev/blog/one-billion-row-challenge/
Apache License 2.0
6.08k stars 1.83k forks source link

tonivade improved solution #582

Closed tonivade closed 7 months ago

tonivade commented 7 months ago

Check List:

This is an improved version of my previous solution. This time I removed the usage of HashMap and I'm using a two dimensions array to store the stations.

I calculate the hash code of the name and then I apply the modulus to array length to get the bucket to store the station. If there are more than one station on the bucket, I iterate searching for the station with the same name length and hash code.

I'm not sure if this makes the solution potential for hash collisions, but it passes all the tests and the solution matches with the baseline output.

Executed in my laptop:

gunnarmorling commented 7 months ago

00:07.894 now.