Watch
1
0
Fork
You've already forked packages
0
packages/markdown/bench/bench.weft
Weft packages 306b143104 packages/ at markup-kit dd1e6eb5270e
A snapshot of packages/ in the Weft repository; the official packages are published from these commits.

Markup-Kit-Commit: dd1e6eb5270e62e0c8b6c202b3d01f0da6e00ddc
2026-11-19 20:43:26 +00:00

12 lines
523 B
Text

// `weft run bench/bench.weft <copies>`: renders the CommonMark spec's examples, joined and repeated, and prints the size.
// scripts/bench.mjs times it from outside the VM, beside markdown-it on the same text.
import { args } from "std/process"
import { log } from "std/log"
import { toHtml } from "../markdown"
import { COMMONMARK } from "../tests/cases"
let copies = try int(args().at(0) ?? "1") else 1
let text = COMMONMARK.map(c => c.markdown).join("\n\n").repeat(copies)
if copies > 0 {
log(toHtml(text).length)
}