Skip to content

Commit

Permalink
Second attempt with various improvements (#510)
Browse files Browse the repository at this point in the history
* Initial chunked impl

* Bytes instead of chars

* Improved number parsing

* Custom hashmap

* Graal and some tuning

* Fix segmenting

* Fix casing

* Unsafe

* Inlining hash calc

* Improved loop

* Cleanup

* Speeding up equals

* Simplifying hash

* Replace concurrenthashmap with lock

* Small changes

* Script reorg

* Native

* Lots of inlining and improvements

* Add back length check

* Fixes

* Small changes

---------

Co-authored-by: Jamal Mulla <[email protected]>
  • Loading branch information
JamalMulla and Jamal Mulla authored Jan 31, 2024
1 parent b91c95a commit e639e2a
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 188 deletions.
10 changes: 8 additions & 2 deletions calculate_average_JamalMulla.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
# limitations under the License.
#

JAVA_OPTS="--enable-preview -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+UseTransparentHugePages"
java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_JamalMulla


if [ -f target/CalculateAverage_JamalMulla_image ]; then
target/CalculateAverage_JamalMulla_image
else
JAVA_OPTS="--enable-preview -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+UseTransparentHugePages -XX:-TieredCompilation"
java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_JamalMulla
fi
8 changes: 7 additions & 1 deletion prepare_JamalMulla.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@
#

source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk use java 21.0.1-graal 1>&2
sdk use java 21.0.2-graal 1>&2

# ./mvnw clean verify removes target/ and will re-trigger native image creation.
if [ ! -f target/CalculateAverage_JamalMulla_image ]; then
NATIVE_IMAGE_OPTS="--gc=epsilon -O3 -march=native --enable-preview --strict-image-heap --link-at-build-time -R:MaxHeapSize=64m -da -dsa --no-fallback --initialize-at-build-time=dev.morling.onebrc.CalculateAverage_JamalMulla"
native-image $NATIVE_IMAGE_OPTS -cp target/average-1.0.0-SNAPSHOT.jar -o target/CalculateAverage_JamalMulla_image dev.morling.onebrc.CalculateAverage_JamalMulla
fi
Loading

0 comments on commit e639e2a

Please sign in to comment.