diff --git a/README.md b/README.md index eb575f4..c83e373 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ These are the results from running all entries into the challenge on eight cores | | 00:17.490 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_kgeri.java)| 21.0.1-open | [Gergely Kiss](https://github.com/kgeri) | | | | 00:18.251 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_seijikun.java)| 21.0.1-graal | [Markus Ebner](https://github.com/seijikun) | | | | 00:18.448 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_moysesb.java)| 21.0.1-open | [Moysés Borges Furtado](https://github.com/moysesb) | | -| | 00:18.583 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_davecom.java)| 21.0.1-open | [David Kopec](https://github.com/davecom) | | +| | 00:18.771 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_davecom.java)| 21.0.1-graal | [David Kopec](https://github.com/davecom) | | | | 00:19.357 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_truelive.java)| 21.0.1-graalce | [Roman Schweitzer](https://github.com/truelive) | | | | 00:21.989 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_couragelee.java)| 21.0.1-open | [couragelee](https://github.com/couragelee) | | | | 00:22.457 | [link](https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_rby.java)| 21.0.1-open | [Ramzi Ben Yahya](https://github.com/rby) | | diff --git a/calculate_average_alesj.sh b/calculate_average_alesj.sh index 2f0536d..075de01 100755 --- a/calculate_average_alesj.sh +++ b/calculate_average_alesj.sh @@ -20,4 +20,4 @@ # sdk use java 21.0.1-graal 1>&2 JAVA_OPTS="" -time java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_alesj +java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_alesj diff --git a/calculate_average_charlibot.sh b/calculate_average_charlibot.sh index 3140beb..1931d1e 100755 --- a/calculate_average_charlibot.sh +++ b/calculate_average_charlibot.sh @@ -17,4 +17,4 @@ JAVA_OPTS="" -time java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_charlibot +java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_charlibot diff --git a/calculate_average_kumarsaurav123.sh b/calculate_average_kumarsaurav123.sh index f6c34d6..1c823e5 100755 --- a/calculate_average_kumarsaurav123.sh +++ b/calculate_average_kumarsaurav123.sh @@ -18,4 +18,4 @@ JAVA_OPTS="-Xms6G -Xmx16G" -time java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_kumarsaurav123 +java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_kumarsaurav123 diff --git a/prepare_davecom.sh b/prepare_davecom.sh old mode 100644 new mode 100755 diff --git a/src/main/java/dev/morling/onebrc/CalculateAverage_kumarsaurav123.java b/src/main/java/dev/morling/onebrc/CalculateAverage_kumarsaurav123.java index bac5588..5b59d05 100644 --- a/src/main/java/dev/morling/onebrc/CalculateAverage_kumarsaurav123.java +++ b/src/main/java/dev/morling/onebrc/CalculateAverage_kumarsaurav123.java @@ -62,17 +62,17 @@ public class CalculateAverage_kumarsaurav123 { } public static void main(String[] args) { - HashMap map=new HashMap<>(); - map.put((byte) 48,0); - map.put((byte) 49,1); - map.put((byte) 50,2); - map.put((byte) 51,3); - map.put((byte) 52,4); - map.put((byte) 53,5); - map.put((byte) 54,6); - map.put((byte) 55,7); - map.put((byte) 56,8); - map.put((byte) 57,9); + HashMap map = new HashMap<>(); + map.put((byte) 48, 0); + map.put((byte) 49, 1); + map.put((byte) 50, 2); + map.put((byte) 51, 3); + map.put((byte) 52, 4); + map.put((byte) 53, 5); + map.put((byte) 54, 6); + map.put((byte) 55, 7); + map.put((byte) 56, 8); + map.put((byte) 57, 9); Collector collector2 = Collector.of( MeasurementAggregator::new, (a, m) -> { @@ -146,26 +146,26 @@ public class CalculateAverage_kumarsaurav123 { byte[] s2 = new byte[i - st]; System.arraycopy(allBytes2, st, s2, 0, s2.length); if (cnt != 0) { - for(int j=0;j=0;k--) { + System.arraycopy(s2, city.length + 1, value, 0, value.length); + double d = 0.0; + int s = -1; + for (int k = value.length - 1; k >= 0; k--) { if (value[k] == 45) { - d=d*-1; + d = d * -1; } else if (value[k] == 46) { - } else { + } + else { d = d + map.get(value[k]).intValue() * Math.pow(10, s); s++; } } - mst.add(new Measurement(new String(city),d)); + mst.add(new Measurement(new String(city), d)); } } @@ -190,7 +190,7 @@ public class CalculateAverage_kumarsaurav123 { measurements.addAll(mst.stream() .collect(groupingBy(Measurement::station, collector)) .values()); -// System.out.println(measurements.size()); + // System.out.println(measurements.size()); } catch (Exception e) { // throw new RuntimeException(e); @@ -251,6 +251,6 @@ public class CalculateAverage_kumarsaurav123 { // .collect(groupingBy(m -> m.station(), collector))); System.out.println(measurements2); -// System.out.println(System.currentTimeMillis() - start); + // System.out.println(System.currentTimeMillis() - start); } }