Agent Skillserweixin/RaTeX › render-bench

render-bench

GitHub

用于 RaTeX 渲染性能基准测试,支持跨工具集成。涵盖100公式全量测试、字体缓存冷/热启动计时及渲染阶段分解,便于对比优化前后的性能差异并定位瓶颈。

.claude/skills/render-bench/SKILL.md erweixin/RaTeX

Trigger Scenarios

评估渲染路径变更后的性能影响 提交优化代码前进行性能验证 比较不同渲染格式(PNG/SVG/PDF)的性能表现

Install

npx skills add erweixin/RaTeX --skill render-bench -g -y
More Options

Non-standard path

npx skills add https://github.com/erweixin/RaTeX/tree/main/.claude/skills/render-bench -g -y

Use without installing

npx skills use erweixin/RaTeX@render-bench

指定 Agent (Claude Code)

npx skills add erweixin/RaTeX --skill render-bench -a claude-code -g -y

安装 repo 全部 skill

npx skills add erweixin/RaTeX --all -g -y

预览 repo 内 skill

npx skills add erweixin/RaTeX --list

SKILL.md

Frontmatter
{
    "name": "render-bench",
    "description": "Run RaTeX rendering performance benchmarks (100-formula PNG\/SVG\/PDF, cold-vs-hot font cache timing, phase breakdown). Use when profiling render performance or comparing before\/after optimization changes."
}

Render performance benchmarks

Cross-tool layout (Cursor / Claude Code / Codex)

  • Canonical copy: repository root skills/render-bench/SKILL.md (this file).
  • Tool entry points (symlinks to this file in-repo):
    • Cursor: .cursor/skills/render-bench/SKILL.md
    • Claude Code: .claude/skills/render-bench/SKILL.md
    • Codex: .agents/skills/render-bench/SKILL.md

When to use

  • After changes to rendering paths (especially renderer.rs, fonts.rs, standalone.rs, outline caching, font loading).
  • Before committing optimizations — run cold first so cache impact is visible.
  • Comparing before/after for a specific renderer (PNG vs SVG vs PDF).

Prerequisites

  • Rust toolchain with --release.
  • KaTeX TTFs in fonts/ (committed in-repo; 20 .ttf files).
  • (Optional) CJK/emoji system fonts for the full CJK/emoji categories.

Commands

1. Full 100-formula benchmark

cargo test -p ratex-render --test bench_render --release -- --ignored --nocapture

Renders 100 formulas across 6 categories (math, complex, matrix, cjk, emoji, chem) in PNG, SVG, SVG-standalone, and PDF. Prints per-category averages and overall throughput (formulas/sec).

Warmup: 1 iteration per formula. Measurement: 3 iterations, averaged.

2. Font cache cold vs hot timing

cargo test -p ratex-render --test font_cache_timing -- --ignored --nocapture

Measures 3 formulas: first pass (cold — disk I/O for font loading), second pass (hot — OnceLock cache hits). Reports speedup ratio.

3. Render phase breakdown

cargo test -p ratex-render --test phase_breakdown --release -- --ignored --nocapture

Per-formula breakdown: parse+layout vs render phase timing. 6 formulas including CJK and emoji cases. Warmup: 3 iterations, Measurement: 10 iterations, averaged.

4. Compare before/after (quick diff)

Useful when optimizing a specific path:

# Before (on main)
cargo test -p ratex-render --test phase_breakdown --release -- --ignored --nocapture 2>&1 | tee /tmp/before.txt

# After (on branch)
cargo test -p ratex-render --test phase_breakdown --release -- --ignored --nocapture 2>&1 | tee /tmp/after.txt

# Diff the tables
diff /tmp/before.txt /tmp/after.txt

Quick checklist

  1. Run cargo test -p ratex-render --test bench_render --release -- --ignored --nocapture for the full picture.
  2. For quick iteration, use phase_breakdown (faster, 6 formulas).
  3. For font-loading specific changes, use font_cache_timing.
  4. Always use --release — debug builds are 10-50× slower and meaningless for perf comparison.

Version History

  • f5af1e0 Current 2026-07-25 05:40

Same Skill Collection

.agents/skills/golden-test-case/SKILL.md
.agents/skills/render-bench/SKILL.md
.claude/skills/golden-test-case/SKILL.md
.cursor/skills/golden-test-case/SKILL.md
skills/golden-test-case/SKILL.md
skills/render-bench/SKILL.md

Metadata

Files
0
Version
f5af1e0
Hash
ddab5aa6
Indexed
2026-07-25 05:40

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 18:28
浙ICP备14020137号-1 $Гость$