From c1954f6a3f1783eaecf9ecb4de6471c716c4105d Mon Sep 17 00:00:00 2001 From: Gunnar Morling Date: Thu, 4 Jan 2024 19:03:42 +0100 Subject: [PATCH] Formatting --- .../CalculateAverage_artsiomkorzun.java | 23 +++++++++++-------- 1 file 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'; }