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

Handling 16 bytes at once #704

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

artsiomkorzun
Copy link
Contributor

NOTE: This challenge closes for submissions on Jan 31 23:59:59 UTC. No new pull requests for adding submissions will be accepted after that time.
Any pending pull requests will be reviewed over the next few days, as described here.
The final leader board will be published by Feb 5.

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: -
  • Execution time of reference implementation: -

@gunnarmorling
Copy link
Owner

Nice improvement! Thank you so much for participating in 1BRC and congrats on creating one of the very top entries! You've added so many tricks adopted by others too, way to go!

Benchmark 1: timeout -v 300 ./calculate_average_artsiomkorzun.sh 2>&1
  Time (mean ± σ):      1.587 s ±  0.005 s    [User: 0.001 s, System: 0.004 s]
  Range (min … max):    1.579 s …  1.598 s    10 runs

Summary
  artsiomkorzun: trimmed mean 1.587168676875, raw times 1.578604839,1.5904227530000001,1.585700493,1.587893237,1.586567214,1.588402829,1.585967739,1.584054185,1.588340965,1.5981434490000002

Leaderboard

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

@gunnarmorling gunnarmorling merged commit da26f61 into gunnarmorling:main Feb 1, 2024
1 check passed
@artsiomkorzun
Copy link
Contributor Author

@gunnarmorling Thank you very much for the challenge. I definitely learned something new and am eager to apply all these SWAR tricks in the real-life code. @thomaswue thank you for the best ILP loop and hinting that the crucial method is not being inlined. @merykitty and @royvanrijn thank you for the SWAR tricks. @jerrinot thank you for ILP and 16-byte branching. @abeobk thank you for the masking idea which makes the later one work as fast as hell.

That was a fun!

long value2 = value(chunk2);
Aggregates.update(pointer2, value2);

long pointer = find(aggregates, chunk2, word1, word2, separator1, separator2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this approach mean the program segfaults on hash collision?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It checks only the first entry, if there is a collision it goes to the bottom. Find is optimistic. Put is pessimistic.

@gunnarmorling
Copy link
Owner

gunnarmorling commented Feb 11, 2024

Hey @artsiomkorzun!

Congrats again on being in the Top 3 of the One Billion Row Challenge!

To celebrate this amazing achievement, I would like to send you a 1BRC t-shirt and coffee mug. To claim your prize, fill out this form by Feb 18. After submitting the form, please provide a comment with the random value you've specified in the form, so that I know it is you who submitted it.

All data entered will solely be used in relation to processing this shipment. Shipments can be sent to any country listed here. A big thank you to Decodable for sponsoring these prizes!

Thanks a lot for participating in 1BRC,

--Gunnar

@artsiomkorzun
Copy link
Contributor Author

Hi @gunnarmorling, thank you very much. The number is 29057 26381

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