Credit:
- Link to original challenge: https://github.com/gunnarmorling/1brc
- (modified)
CreateMeasurements.java
Licensed under the Apache License, Version 2.0 (the "License"); Copyright 2023 The original authors
git clone https://github.com/new-AF/1-billion-row-challenge-JS-solution
I use Windows so get pbench.exe
from
- You will a need JDK, to compile and run
./java-code/CreateMeasurements.java
- I use openJDK (.zip portable), so download latest version (current 22.0.1) from
- extract the base folder
jdk-22.0.1
- navigate into the
bin
folder - copy the full path of
javac.exe
andjava.exe
Navigate back to your copy of this cloned repo:
- navigate into your cloned
java-code
folder, compile and run the java program:"C:/Users/Your-User-Name/Downloads/jdk-22.0.1/bin/javac.exe" CreateMeasurements.java
"C:/Your-User-Name/Downloads/jdk-22.0.1/bin/java.exe" CreateMeasurements 1_000_000
(1_000_000_000 will be 12.8GB file)
Navigate back to your copy of this cloned repo:
./pbench.exe node "my solution.js" "./java-code/measurements.txt"
This is a straight-forward single-threaded solution which processed 1 billion rows in 22 minutes on my 11th gen i3 laptop.
== Performance of node "my solution.js" ./java-code/measurements.txt
Real time: 1271.067 s
CPU time: 1255.140 s
User time: 1238.984 s
Kernel time: 16.156 s
Read IO: 210506 (13472149 KB)
Write IO: 0 ( 0 KB)
Other IO: 187 ( 1 KB)
Peak WS size: 63788 KB
Total time: 1271.080 s