Skip to content

Commit

Permalink
ref #168 Faster parsing by no longer pooling StringBuilders in Source…
Browse files Browse the repository at this point in the history
…Reader.readNumber(); decreased parsing time by 50% for the particular document used for investigation.
  • Loading branch information
ediweissmann committed Sep 3, 2024
1 parent c6e0936 commit d517924
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/sejda/sambox/input/SourceReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -531,7 +532,7 @@ public final String readNumber() throws IOException
}
finally
{
pool.give(builder);
//pool.give(builder);
}
}

Expand Down

0 comments on commit d517924

Please sign in to comment.