From 7e5b762c0d67cae32348e551b24eb8228f140316 Mon Sep 17 00:00:00 2001 From: ahr Date: Fri, 9 Mar 2018 08:38:58 +0100 Subject: [PATCH] pre-compute firstByteMaxValue this operation is executed very often during ingestion --- .../src/main/java/org/lucares/performance/db/ByteType.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/performanceDb/src/main/java/org/lucares/performance/db/ByteType.java b/performanceDb/src/main/java/org/lucares/performance/db/ByteType.java index bb5eacc..e995a99 100644 --- a/performanceDb/src/main/java/org/lucares/performance/db/ByteType.java +++ b/performanceDb/src/main/java/org/lucares/performance/db/ByteType.java @@ -28,9 +28,11 @@ enum ByteType { } private final int firstBytePrefix; + private final int firstByteMaxValue; private ByteType(final int firstBytePrefix) { this.firstBytePrefix = firstBytePrefix; + firstByteMaxValue = firstBytePrefix-1; } public int getBytePrefix() { @@ -48,7 +50,7 @@ enum ByteType { * @return the maximum value for the first byte of this sequence */ public long getFirstByteMaxValue() { - return firstBytePrefix - 1; + return firstByteMaxValue; } /**