Optimize svgbob rendering hot paths - #125
Open
exlee wants to merge 1 commit into
Open
Conversation
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.
I am evaluating svgbob as a library backend for my DiagramIDE app.
Before integrating it as another diagram output language, I profiled the
renderer (current Pikchr output is mindboggingly fast) and found some scaling
problems on larger connected diagrams.
I used GPT-5.6 as an optimization partner while investigating the hot paths, and
wanted to share the concrete results with the upstream project.
I do not have any expectations toward handling this PR. If it's not aligning
with project direction or personal views, feel free to disregard it - I merely
found a value in it and thought it's share-worthy.
Results
Release build benchmark using
svgbob_cli, with three warmup runs and eighttimed runs per fixture:
simple.bobdemo.boblong.bobcircles.bobexample.bobThe generated SVGs were byte-for-byte identical for all five fixtures.
What changed
connectivity over neighboring cells, while preserving input order.
FragmentTreenodes instead ofrecalculating geometry bounds during every containment comparison.
template cell is absent, avoiding the second scan for unmatched cells.
0.7.5to0.7.6.Verification
cargo test --offline -p svgbobsimple_shapesintegration tests passedcargo fmt --all -- --checkpassed.cargo clippy --offline -p svgbob --all-targets -- -D warningsstill reports24 existing upstream lint findings in untouched code; none are introduced by
these changes.
LLM Disclaimer
I've set search boundary condition, harness, search requirements and let GPT 5.6 Sol/Luna run.
There wasn't much work on my side toward this contribution, outside of preparing this PR and validating result.