Skip to content

fix: skip markdown pipeline for whitespace-only text in renderNodes (#143)#144

Merged
rohal12 merged 5 commits intomainfrom
fix/published-types-sync
Mar 27, 2026
Merged

fix: skip markdown pipeline for whitespace-only text in renderNodes (#143)#144
rohal12 merged 5 commits intomainfrom
fix/published-types-sync

Conversation

@rohal12
Copy link
Copy Markdown
Owner

@rohal12 rohal12 commented Mar 27, 2026

Summary

  • Performance fix for issue Performance: renderNodes runs full micromark + innerHTML pipeline per {for} iteration #143: Extend the renderNodes fast path to skip the micromark + innerHTML pipeline when all text nodes contain only whitespace (indentation, newlines between HTML tags)
  • Eliminates ~97 redundant pipeline calls per render in {for} loops over HTML + macro content, addressing 89% of wall time in Chrome CPU profiles
  • Preserves blank-line (\n\n) detection to maintain paragraph separation semantics

Also includes (prior work on this branch)

Test plan

  • 3 new correctness baseline tests for the fast path
  • Full test suite passes (1090 tests)
  • Type check clean (tsc --noEmit)
  • Manual verification: re-profile the 23-item for-loop passage in Chrome to confirm wall time reduction

🤖 Generated with Claude Code

clem and others added 4 commits March 28, 2026 00:58
…#143)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…143)

Extend the existing fast path to detect when all text nodes contain only
whitespace (indentation, newlines between HTML tags). In this case, skip
the micromark + innerHTML + DOM walk pipeline entirely and render nodes
directly via renderSingleNode.

For a {for} loop over 23 HTML cards, this eliminates ~97 redundant
pipeline calls that account for 89% of wall time in Chrome profiles.
@github-actions
Copy link
Copy Markdown

Release preview: merging this PR will publish v0.43.3 (patch bump from v0.43.2)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.39% 2832 / 3659
🔵 Statements 76.38% 3093 / 4049
🔵 Functions 69% 512 / 742
🔵 Branches 73.39% 1545 / 2105
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/markup/render.tsx 88.79% 80% 100% 92.15% 77, 87, 125, 190-196, 211-212, 223, 244, 245, 246, 250-251
Generated in workflow #221 for commit dde86a5 by the Vitest Coverage Report Action

@rohal12 rohal12 enabled auto-merge March 27, 2026 17:11
@rohal12 rohal12 merged commit bfe8fc7 into main Mar 27, 2026
5 checks passed
@rohal12 rohal12 deleted the fix/published-types-sync branch March 27, 2026 17:14
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