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

jerrinot's improvement #607

Closed jerrinot closed 7 months ago

jerrinot commented 7 months ago

Check List:

the main change: Thomas's spawning trick. I shamelessly copy'n'pasted it directly from his code. there are a few other tweaks, most with a questionable value.

gunnarmorling commented 7 months ago

It's actually a tad slower:

Benchmark 1: timeout -v 300 ./calculate_average_jerrinot.sh 2>&1
  Time (mean ± σ):      2.445 s ±  0.046 s    [User: 15.362 s, System: 0.798 s]
  Range (min … max):    2.399 s …  2.513 s    5 runs

Summary
  jerrinot: trimmed mean 2.4378531110533332, raw times 2.42589644272,2.3986416297199997,2.51291899172,2.41892198572,2.4687409047199997

Leaderboard

| # | Result (m:s.ms) | Implementation     | JDK | Submitter     | Notes     |
|---|-----------------|--------------------|-----|---------------|-----------|
|   | 00:02.437 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_jerrinot.java)| 21.0.1-graal | [Jaromir Hamala](https://github.com/jerrinot) | uses Unsafe |

I believe the spawning trick isn't beneficial with the JVM (i.e. non-native binary).

jerrinot commented 7 months ago

Thanks for a super fast feedback! It was faster in my local testing. Well, worse things happen at sea😂

jerrinot commented 7 months ago

@gunnarmorling I pushed another commit - switching to AOT compilation. can you please give it another try? many thanks!

gunnarmorling commented 7 months ago

Yepp, looking better now :)

Benchmark 1: timeout -v 300 ./calculate_average_jerrinot.sh 2>&1
  Time (mean ± σ):      2.149 s ±  0.012 s    [User: 0.002 s, System: 0.004 s]
  Range (min … max):    2.130 s …  2.169 s    10 runs

Summary
  jerrinot: trimmed mean 2.14925808789, raw times 2.12968131914,2.14882771614,2.16860506514,2.14067246814,2.14426029714,2.14588217214,2.14475244114,2.15095327814,2.16637959914,2.15233673114

Leaderboard

| # | Result (m:s.ms) | Implementation     | JDK | Submitter     | Notes     |
|---|-----------------|--------------------|-----|---------------|-----------|
|   | 00:02.149 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_jerrinot.java)| 21.0.2-graal | [Jaromir Hamala](https://github.com/jerrinot) | GraalVM native binary, uses Unsafe |