[PR #10000] refactor(desktop): move markdown rendering to rust #13298

Closed
opened 2026-02-16 18:18:09 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10000

State: closed
Merged: Yes


What does this PR do?

moves markdown parsing from javascript (marked) to rust (comrak) in the desktop app for better performance. syntax highlighting and katex remain in js post-processing

How did you verify your code works?

tested markdown rendering in the desktop app - headings, lists, code blocks, tables, and inline formatting all render correctly

also ran a benchmark to measure perf

[Log] ====================================================================== (markdown-benchmark.ts, line 161)
MARKDOWN PARSER BENCHMARK RESULTS
======================================================================

📄 SMALL (91 chars)
--------------------------------------------------
  JS marked:
    avg: 0.180ms | min: 0.000ms | max: 1.000ms
    throughput: 5555.6 ops/sec
  Rust comrak:
    avg: 0.680ms | min: 0.000ms | max: 1.000ms
    throughput: 1470.6 ops/sec
  ⚡ JS is 3.78x faster

📄 MEDIUM (1,510 chars)
--------------------------------------------------
  JS marked:
    avg: 7.900ms | min: 7.000ms | max: 10.000ms
    throughput: 126.6 ops/sec
  Rust comrak:
    avg: 0.760ms | min: 0.000ms | max: 2.000ms
    throughput: 1315.8 ops/sec
  ⚡ Rust is 10.39x faster

📄 LARGE (30,584 chars)
--------------------------------------------------
  JS marked:
    avg: 186.960ms | min: 182.000ms | max: 204.000ms
    throughput: 5.3 ops/sec
  Rust comrak:
    avg: 5.740ms | min: 5.000ms | max: 12.000ms
    throughput: 174.2 ops/sec
  ⚡ Rust is 32.57x faster
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10000 **State:** closed **Merged:** Yes --- ### What does this PR do? moves markdown parsing from javascript (marked) to rust (comrak) in the desktop app for better performance. syntax highlighting and katex remain in js post-processing ### How did you verify your code works? tested markdown rendering in the desktop app - headings, lists, code blocks, tables, and inline formatting all render correctly also ran a benchmark to measure perf ``` [Log] ====================================================================== (markdown-benchmark.ts, line 161) MARKDOWN PARSER BENCHMARK RESULTS ====================================================================== 📄 SMALL (91 chars) -------------------------------------------------- JS marked: avg: 0.180ms | min: 0.000ms | max: 1.000ms throughput: 5555.6 ops/sec Rust comrak: avg: 0.680ms | min: 0.000ms | max: 1.000ms throughput: 1470.6 ops/sec ⚡ JS is 3.78x faster 📄 MEDIUM (1,510 chars) -------------------------------------------------- JS marked: avg: 7.900ms | min: 7.000ms | max: 10.000ms throughput: 126.6 ops/sec Rust comrak: avg: 0.760ms | min: 0.000ms | max: 2.000ms throughput: 1315.8 ops/sec ⚡ Rust is 10.39x faster 📄 LARGE (30,584 chars) -------------------------------------------------- JS marked: avg: 186.960ms | min: 182.000ms | max: 204.000ms throughput: 5.3 ops/sec Rust comrak: avg: 5.740ms | min: 5.000ms | max: 12.000ms throughput: 174.2 ops/sec ⚡ Rust is 32.57x faster ```
yindo added the pull-request label 2026-02-16 18:18:09 -05:00
yindo closed this issue 2026-02-16 18:18:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13298