Repository navigation
Users/pgo/performance issues - #6
Conversation
sahebansari
left a comment
There was a problem hiding this comment.
One of the test cases is failing, which is currently blocking this PR from being merged. Could you please take a look and fix it?
|
Why ShowIfFalseHeadingIsNotInTableOfContents was changed What failed On every target framework (net8.0, net9.0, net10.0), CI failed with: Assert.Equal() Failure: Values differ Cause: the test was out of date, the library is fine The test assumed text was drawn one word at a time, so it looked for (Public) Tj in the content stream. The performance commits (7bba9a4, 12314b9, 85e0bd5) changed text rendering to draw one Tj per line. For this document the output is now: (1 Public chapter) Tj ← table of contents entry There was a second problem. Assert.DoesNotContain("(Secret) Tj", content) could no longer fail, because the renderer never writes that string any more, not even when the heading is drawn. It would have missed a real regression. The change
|
Performance work across the library
This PR makes TerraPDF 2–30× faster in realistic workloads and cuts allocations by 60–95%. Output is byte-identical except for three intended changes, listed at the end. It adds a benchmark suite, a throughput harness and verification tools, so the gains can be measured and checked.
Throughput in a 2-CPU / 1 GB Docker container (
benchmarks/TerraPDF.Throughput):Tjper run of wordsDecodePng8.1 → 2.4 MBIntended output changes
Tj. PDFs are up to 14% smaller; glyphs sit within 0.01 pt of before./Predictor 15instead of being decoded and recompressed.?drawn in their place. Text containing these characters may wrap differently.Verification
tools/pdf-compare.Full analysis and numbers:
benchmarks/benchmarks-analysis-2026-09-26.md. How to run:docs/benchmarks.md.