Skip to content

bench: document optimization trials and cover initial history restore - #31

Merged
Simon-He95 merged 3 commits into
mainfrom
codex/markstream-linkify-cpu
Sep 7, 2026
Merged

bench: document optimization trials and cover initial history restore#31
Simon-He95 merged 3 commits into
mainfrom
codex/markstream-linkify-cpu

Conversation

@Simon-He95

@Simon-He95 Simon-He95 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

The existing consumer benchmark measures appends after loading a large history, but does not separately measure the initial parse of one large history document. Add 100k/1m first-restore cases and record the completed streaming/CPU investigation, including reproducible final measurements and rejected experiments.

The only retained runtime optimization is in markstream-vue #753. This PR changes the benchmark and evidence only. All experimental markdown-it-ts production changes were reverted because they lacked stable independent consumer benefit or failed compatibility checks. Both final benchmark variants use byte-identical parser builds.

The report includes:

  • All 61 final scenarios, five-round raw samples, bundle/workload hashes and per-frame output parity.
  • Long-paragraph streaming CPU −20.2%, mixed 100-message restore −14.3%, table restore −9.4%, long-paragraph restore −36.0%.
  • Negative results, including README/link-heavy streaming and workload/JIT-sensitive CRLF, hook and no-reuse results. No universal speedup or full-UI acceleration claim.
  • Stock table reuse, core/per-call/whole-inline linkify screening, regex warming, finalizer and cache-guard experiments, plus the semantic counterexamples that ruled out unsafe variants. Earlier Worker/AST experiments are explicitly labeled historical evidence.
  • Pinned baseline/candidate revisions and reproduction instructions, verified with a fresh archived-source build and parity smoke.

Validation: slow streaming suite enabled (61 files / 1,187 tests passed; 9 skipped), lint, typecheck, test:types, build, benchmark syntax, JSON medians/hash validation and git diff --check. Consumer validation: 3,088 tests, lint/typechecks/build, main playground smoke and rich-content scroll assertions on a bounded diagnostic rerun.

CI fix: regenerated the native performance snapshot with pnpm run perf:all:latest and updated both README metric blocks. perf:methodology:check and perf:update-readme:check now pass locally. The original snapshot fingerprint was already stale at the base commit; it has been replaced with an actual fresh measurement, not a manually changed fingerprint. This remains a benchmark/evidence PR with no parser runtime changes.

Consumer CI follow-up: the initial screen caused a repeatable peak-frame regression by deferring regex initialization. Markstream 447940331 preserves native cold streaming initialization timing, and its online performance job now passes without changing thresholds. docs/perf-stream-history-ci-followup.md/json contains the diagnosis, original CI artifacts, six local CI benchmark scenarios and a fresh 61-case matrix. The earlier report is explicitly labeled as the initial candidate.

@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for markdown-it-ts ready!

Name Link
🔨 Latest commit de04068
🔍 Latest deploy log https://app.netlify.com/projects/markdown-it-ts/deploys/6a9e7f5184e61b00089aeb09
😎 Deploy Preview https://deploy-preview-31--markdown-it-ts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T08:57:24.177438Z fab06d3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fab06d3706

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

workloads.push({ name: `options-restore-${name}`, messages: Array.from({ length: 60 }, (_, i) => unit(i).repeat(15)), options })
}
for (const size of [100_000, 1_000_000]) {
workloads.push({ name: `history-restore-${size}`, messages: [prose(0).repeat(Math.ceil(size / prose(0).length))] })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a fresh parser for first-restore workloads

When --warmups is nonzero (the documented runs use 2 or 50), each new one-message workload resolves the same getMarkdown('history-0') key already used by earlier restore workloads and warmup passes. Because getMarkdown caches by key, the measured pass reuses warmed parser/linkify state and excludes parser creation, so these cases do not measure the claimed initial large-history restore. Use a unique key per workload/run or clear the parser cache before timing.

Useful? React with 👍 / 👎.

@Simon-He95 Simon-He95 changed the title perf: measure full history restore and document optimization trials bench: document optimization trials and cover initial history restore Sep 7, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploying markdown-it-ts with  Cloudflare Pages  Cloudflare Pages

Latest commit: de04068
Status: ✅  Deploy successful!
Preview URL: https://e724ec89.markdown-it-ts.pages.dev
Branch Preview URL: https://codex-markstream-linkify-cpu.markdown-it-ts.pages.dev

View logs

@Simon-He95
Simon-He95 merged commit 5ff70d4 into main Sep 7, 2026
14 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