From d5179247476c1b8917e3c16b4dd9a5e0e13e1785 Mon Sep 17 00:00:00 2001 From: Edi Weissmann Date: Tue, 3 Sep 2024 19:26:13 +0200 Subject: [PATCH] ref #168 Faster parsing by no longer pooling StringBuilders in SourceReader.readNumber(); decreased parsing time by 50% for the particular document used for investigation. --- src/main/java/org/sejda/sambox/input/SourceReader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sejda/sambox/input/SourceReader.java b/src/main/java/org/sejda/sambox/input/SourceReader.java index 722915b9d..01c4d8f68 100644 --- a/src/main/java/org/sejda/sambox/input/SourceReader.java +++ b/src/main/java/org/sejda/sambox/input/SourceReader.java @@ -495,7 +495,8 @@ public final String readIntegerNumber() throws IOException */ public final String readNumber() throws IOException { - StringBuilder builder = pool.borrow(); + //StringBuilder builder = pool.borrow(); + StringBuilder builder = new StringBuilder(); int lastAppended = -1; try { @@ -531,7 +532,7 @@ public final String readNumber() throws IOException } finally { - pool.give(builder); + //pool.give(builder); } }