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

Tuning and subprocess spawn for thomaswue #533

Merged
merged 6 commits into from
Jan 21, 2024

Conversation

thomaswue
Copy link
Contributor

Check List:

  • Tests pass (./test.sh <username> shows no differences between expected and actual outputs)
  • All formatting changes by the build are committed
  • Your launch script is named calculate_average_<username>.sh (make sure to match casing of your GH user name) and is executable
  • Output matches that of calculate_average_baseline.sh
  • For new entries, or after substantial changes: When implementing custom hash structures, please point to where you deal with hash collisions (line number)
  • Execution time: 0.47s
  • Execution time of reference implementation: 120.37s

Apart from some minor tunings (which should amount to ~3%), this PR now creates a subprocess to do the actual work. The main process returns immediately once the output is calculated. The OS clean up unmapping the pages that were mapped in continues in the background process. The code for this is just a few lines of Java Process API in the spawnWorker method. The subprocess is started with the exact same command as the original process, but with a "--worker" argument.

I have also updated the Graal version to the latest CPU release (21.0.2).

@artsiomkorzun
Copy link
Contributor

@thomaswue so is it officially allowed?

@thomaswue
Copy link
Contributor Author

@gunnarmorling said he is considering to allow it. Let's see how it works with the official evaluation setup.

@gunnarmorling gunnarmorling merged commit d0a2859 into gunnarmorling:main Jan 21, 2024
1 check passed
@gunnarmorling
Copy link
Owner

00:02.195, very nice! 2 sec is in sight :) Clearly on #1 now, but @abeobk and @artsiomkorzun haven't applied the same trick yet, so...

Benchmark 1: timeout -v 300 ./calculate_average_thomaswue.sh 2>&1
  Time (mean ± σ):      2.194 s ±  0.022 s    [User: 0.002 s, System: 0.003 s]
  Range (min … max):    2.154 s …  2.225 s    10 runs

Summary
  thomaswue: trimmed mean 2.19571922781, raw times 2.15433713906,2.20952494606,2.17099705406,2.20550811606,2.19039166406,2.22460009706,2.20810557306,2.17378339906,2.20745058306,2.19999248706

Leaderboard

| # | Result (m:s.ms) | Implementation     | JDK | Submitter     | Notes     |
|---|-----------------|--------------------|-----|---------------|-----------|
|   | 00:02.195 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_thomaswue.java)| 21.0.2-graal | [Thomas Wuerthinger](https://github.com/thomaswue) | GraalVM native binary |

@thomaswue
Copy link
Contributor Author

Cool, thank you! Let's gooo ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants