This issue has been created
There are 2 updates.
 
 
XWiki Rendering / cid:jira-generated-image-avatar-3ce50776-f34e-456b-b4f8-c6e4ec9db9b0 XRENDERING-822 Open

The plain text parser allocates a 16 KB buffer for each parsed text

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-0b745ec0-881a-42e8-824c-852325bd4c42 Michael Hamann created this issue on 19/Oct/26 16:47
 
Summary: The plain text parser allocates a 16 KB buffer for each parsed text
Issue Type: cid:jira-generated-image-avatar-3ce50776-f34e-456b-b4f8-c6e4ec9db9b0 Improvement
Affects Versions: 17.10.0
Assignee: Unassigned
Components: Syntax - plain/1.0
Created: 19/Oct/26 16:47
Labels: performance
Priority: cid:jira-generated-image-static-major-941e9771-3e8a-4678-9a6c-2dc80728087b Major
Reporter: Michael Hamann
Description:

PlainTextStreamParser wraps each source it parses in a BufferedReader, which allocates a 16 KB buffer, even when the source is already in memory, like a StringReader. Allocating this buffer costs more than parsing a short text.

This matters for code that parses many short texts, like the code macro, which parses the text of each token of the highlighted code: highlighting a short snippet allocates several megabytes, which slows down the rendering of pages with many code macros, especially when many of them are rendered at the same time.

The buffer is only useful for a source that is costly to read character by character, so the parser shouldn't add one to a source that is already in memory or already buffered.

 
 

2 updates

 
cid:jira-generated-image-avatar-0b745ec0-881a-42e8-824c-852325bd4c42 Changes by Michael Hamann on 19/Oct/26 16:48
 
Fix Version: 18.10.0-rc-1
Assignee: Michael Hamann