From 56292fd4efb1749533d5d7dcd7235ebe89187099 Mon Sep 17 00:00:00 2001 From: Gregory Chanan Date: Fri, 18 Mar 2016 14:36:15 -0700 Subject: [PATCH] LUCENE-7115: Speed up FieldCache.CacheEntry toString by setting initial StringBuilder capacity --- lucene/CHANGES.txt | 3 +++ .../src/java/org/apache/lucene/uninverting/FieldCache.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 46cddb255cc..26ef3e69b42 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -29,6 +29,9 @@ Optimizations * LUCENE-7097: IntroSorter now recurses to 2 * log_2(count) quicksort stack depth before switching to heapsort (Adrien Grand, Mike McCandless) +* LUCENE-7115: Speed up FieldCache.CacheEntry toString by setting initial + StringBuilder capacity (Gregory Chanan) + ======================= Lucene 6.0.0 ======================= System Requirements diff --git a/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCache.java b/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCache.java index 27d68e04abb..11185a903e9 100644 --- a/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCache.java +++ b/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCache.java @@ -404,7 +404,7 @@ interface FieldCache { @Override public String toString() { - StringBuilder b = new StringBuilder(); + StringBuilder b = new StringBuilder(250); b.append("'").append(getReaderKey()).append("'=>"); b.append("'").append(getFieldName()).append("',"); b.append(getCacheType()).append(",").append(getCustom());