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

Final version for thomaswue #674

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Conversation

thomaswue
Copy link
Contributor

Check List:

  • You have run ./mvnw verify and the project builds successfully
  • 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.39
  • Execution time of reference implementation: 120.37

Added detailed comments for the used native image flags, some code clean up for better naming, some minor tuning. This translates to around 2% faster on my machine, but let's see if this also holds up for the reference machine.

@gunnarmorling
Copy link
Owner

Nice!

Benchmark 1: timeout -v 300 ./calculate_average_thomaswue.sh 2>&1
  Time (mean ± σ):      1.830 s ±  0.011 s    [User: 0.002 s, System: 0.004 s]
  Range (min … max):    1.798 s …  1.836 s    10 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Summary
  thomaswue: trimmed mean 1.832794623615, raw times 1.7984286922400001,1.83378488024,1.8358817772400002,1.8351058012400001,1.8321136482400002,1.83353322124,1.83313856524,1.8319531362400001,1.83227779624,1.83044994024

Leaderboard

| # | Result (m:s.ms) | Implementation     | JDK | Submitter     | Notes     |
|---|-----------------|--------------------|-----|---------------|-----------|
|   | 00:01.832 | [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, uses Unsafe |

@gunnarmorling gunnarmorling merged commit a5ce4ba into gunnarmorling:main Jan 31, 2024
1 check passed
}

long dist = (segmentEnd - segmentStart) / 3;
long midPoint1 = nextNewLine(segmentStart + dist);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to learn it. Why dividing the workload into 3 parts and process them simuteneously benifits performance? I am curious about the programming skill?

Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way the x86 processor is able to better use its processing units to execute more instructions per cycle. I am preparing some more information and blog post about this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I am looking forward your blog. I didn't find it in the resource list. Is it in progress? I don't want to miss the great blog.

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