Repository navigation
perf(plot): buffer commands in \pgfplothandlerrecord - #1486
Open
diracdeltafunk wants to merge 1 commit into
Open
diracdeltafunk wants to merge 1 commit into
diracdeltafunk wants to merge 1 commit into
Conversation
\pgfplothandlerrecord appended every plot stream command to the recording macro with \gdef, copying the whole recording each time. Since TikZ records every `plot coordinates` stream, such plots took quadratic time in the number of points (16000 points: 16.3 s). Collect commands in a small buffer instead and append it to the recording every 64 commands and at the end of the stream. The recorded macro is token for token the same (16000 points: 1.5 s, identical PDF). The time complexity is still quadratic, but now the constant has been cut by a factor of roughly 64. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Ben Spitz <1844060+diracdeltafunk@users.noreply.github.com>
diracdeltafunk
force-pushed
the
perf/plot-record-buffer
branch
from
November 9, 2026 16:37
eca8519 to
18ce3d7
Compare
2 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This code was written by Claude Opus 5.5, and reviewed/edited by myself and Hood Chatham.
Motivation for this change
\pgfplothandlerrecord appended every plot stream command to the recording macro with \gdef, copying the whole recording each time. Since TikZ records every
plot coordinatesstream, such plots take quadratic time in the number of points. Collect commands in a small buffer instead and append it to the recording every 64 commands and at the end of the stream. The recorded macro is the same, and the time complexity is still quadratic, but now the constant has been cut by a factor of roughly 64.Checklist
Please signoff your commits to explicitly state your agreement to the Developer Certificate of Origin. If that is not possible you may check the boxes below instead: