aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGunnar Morling <gunnar.morling@googlemail.com>2024-01-04 19:03:42 +0100
committerGunnar Morling <gunnar.morling@googlemail.com>2024-01-04 19:03:42 +0100
commitc1954f6a3f1783eaecf9ecb4de6471c716c4105d (patch)
tree7ef9b175e00cce544a9ab5891f7881273e0f8d1d /src
parent9b0b10f10196c5106f3b47f47cd3832e635153e2 (diff)
Formatting
Diffstat (limited to 'src')
-rw-r--r--src/main/java/dev/morling/onebrc/CalculateAverage_artsiomkorzun.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/main/java/dev/morling/onebrc/CalculateAverage_artsiomkorzun.java b/src/main/java/dev/morling/onebrc/CalculateAverage_artsiomkorzun.java
index 21a8e60..5efd4a7 100644
--- a/src/main/java/dev/morling/onebrc/CalculateAverage_artsiomkorzun.java
+++ b/src/main/java/dev/morling/onebrc/CalculateAverage_artsiomkorzun.java
@@ -37,12 +37,14 @@ public class CalculateAverage_artsiomkorzun {
private static final int SEGMENT_OVERLAP = 1024;
public static void main(String[] args) throws Exception {
- /*for (int i = 0; i < 10; i++) {
- long start = System.currentTimeMillis();
- execute();
- long end = System.currentTimeMillis();
- System.err.println("Time: " + (end - start));
- }*/
+ /*
+ * for (int i = 0; i < 10; i++) {
+ * long start = System.currentTimeMillis();
+ * execute();
+ * long end = System.currentTimeMillis();
+ * System.err.println("Time: " + (end - start));
+ * }
+ */
execute();
}
@@ -103,7 +105,8 @@ public class CalculateAverage_artsiomkorzun {
private static long size(Path file) {
try {
return Files.size(file);
- } catch (IOException e) {
+ }
+ catch (IOException e) {
throw new RuntimeException(e);
}
}
@@ -111,7 +114,8 @@ public class CalculateAverage_artsiomkorzun {
private static MappedByteBuffer map(long position, int size) {
try (FileChannel channel = FileChannel.open(FILE, StandardOpenOption.READ)) {
return channel.map(FileChannel.MapMode.READ_ONLY, position, size); // leaking until gc
- } catch (Throwable e) {
+ }
+ catch (Throwable e) {
throw new RuntimeException(e);
}
}
@@ -138,7 +142,8 @@ public class CalculateAverage_artsiomkorzun {
b = buffer.get();
if (b == '-') {
multiplier = -1;
- } else {
+ }
+ else {
assert b >= '0' && b <= '9';
value = b - '0';
}