Skip to content

perf: batch table string insertions - #668

Merged
vincentarelbundock merged 1 commit into
mainfrom
simpler666
Jul 10, 2026
Merged

perf: batch table string insertions#668
vincentarelbundock merged 1 commit into
mainfrom
simpler666

Conversation

@vincentarelbundock

Copy link
Copy Markdown
Owner

Summary

Batch generated Typst and HTML content before calling lines_insert(), reducing repeated splitting and collapsing of the growing table string without introducing a parallel line-oriented helper API.

This is a smaller alternative to #666. It keeps the existing lines_insert() abstraction and changes only the hot call sites:

  • batch Typst horizontal and vertical rules
  • batch Typst style-array entries and notes
  • batch HTML span listeners, style arrays, and CSS entries
  • flatten nested vertical-line results before insertion
  • preserve the existing insertion order byte-for-byte

Benchmarks

Median build_tt() rendering time, measured in separate main and simpler666 worktrees after warm-up. Primary cases used 30 iterations.

Workload main This PR Change
Typst, plain 20x8 9.54 ms 9.30 ms 2.5% faster
Typst, 320 distinct styles 88.60 ms 35.61 ms 59.8% faster
Typst, 200 notes 35.11 ms 13.27 ms 62.2% faster
HTML, plain 20x8 17.31 ms 17.37 ms unchanged
HTML, 320 distinct styles 569.16 ms 107.23 ms 81.2% faster
Typst, many borders on 500x10 3815 ms 3088 ms 19.1% faster
HTML, many borders on 500x10 3821 ms 3833 ms unchanged

Verification

  • Focused Typst tests: 32 passed
  • Full scrutin suite: 437 passed, 0 failed, 1 skipped
  • git diff --check passes

The issue #592 snapshot is covered and remains byte-for-byte unchanged.

@vincentarelbundock
vincentarelbundock merged commit b37458e into main Jul 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant