From 4f57a29c3b78f79e49aab5a08f941ab32d1f9b86 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Sat, 25 May 2019 17:55:14 +0200 Subject: [PATCH] increase cache of stringified longs This should improve the csv generation a little bit. --- .../org/lucares/recommind/logs/LongUtils.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pdb-plotting/src/main/java/org/lucares/recommind/logs/LongUtils.java b/pdb-plotting/src/main/java/org/lucares/recommind/logs/LongUtils.java index 0493d08..9be22cf 100644 --- a/pdb-plotting/src/main/java/org/lucares/recommind/logs/LongUtils.java +++ b/pdb-plotting/src/main/java/org/lucares/recommind/logs/LongUtils.java @@ -1,22 +1,22 @@ package org.lucares.recommind.logs; public class LongUtils { - - private static final int INT_TO_STRING_CACHE_SIZE= 1000; + + private static final int INT_TO_STRING_CACHE_SIZE = 10_000; private static final String[] INT_TO_STRING; static { - + INT_TO_STRING = new String[INT_TO_STRING_CACHE_SIZE]; - - for (int i = 0; i < INT_TO_STRING_CACHE_SIZE; i++){ + + for (int i = 0; i < INT_TO_STRING_CACHE_SIZE; i++) { INT_TO_STRING[i] = String.valueOf(i); } } - - public static String longToString(final long value){ - // using pre-generated strings reduces memory allocation by up to 25% - - if (value < INT_TO_STRING_CACHE_SIZE){ + + public static String longToString(final long value) { + // using pre-generated strings reduces memory allocation by up to 25% + + if (value < INT_TO_STRING_CACHE_SIZE) { return INT_TO_STRING[(int) value]; } return String.valueOf(value);