Skip to content

Commit db93cd4

Browse files
committed
perf(web): highlight code with @pierre/highlights instead of Shiki
1 parent 0bf9c11 commit db93cd4

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎apps/web/src/lib/syntaxHighlighting.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import {
88
import { resolveDiffThemeName } from "./diffRendering";
99

1010
/**
11-
* Always highlight with the Oniguruma WASM engine — the JS regex engine can
12-
* backtrack catastrophically and hang the tokenizing thread. The shared
13-
* highlighter is a first-caller-wins singleton, so every creation site must
14-
* pass this value.
11+
* Highlights' hand-written WASM lexers tokenize large files 10-40x faster than
12+
* Shiki and never backtrack like Shiki's JS regex engine. Only one highlighter
13+
* type can be active per thread, so every creation site must pass this value.
1514
*/
16-
export const PREFERRED_HIGHLIGHTER: HighlighterTypes = "shiki-wasm";
15+
export const PREFERRED_HIGHLIGHTER: HighlighterTypes = "highlights";
1716

1817
const highlighterPromiseCache = new Map<string, Promise<DiffsHighlighter>>();
1918

0 commit comments

Comments
 (0)