Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1235 +/- ##
==========================================
+ Coverage 93.99% 94.04% +0.04%
==========================================
Files 301 302 +1
Lines 31520 31648 +128
Branches 3216 3233 +17
==========================================
+ Hits 29627 29763 +136
+ Misses 1871 1863 -8
Partials 22 22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
|
| File | Main | PR | Change |
|---|---|---|---|
addons.html |
374.52 KB | 329.16 KB | -45.36 KB (-12.1%) |
embedding.html |
64.38 KB | 57.78 KB | -6.60 KB (-10.3%) |
async_context.html |
247.17 KB | 245.10 KB | -2.08 KB (-0.8%) |
tls.html |
301.26 KB | 302.80 KB | +1.54 KB (+0.5%) |
n-api.html |
822.59 KB | 822.23 KB | -364.00 B (-0.0%) |
readline.html |
219.10 KB | 219.27 KB | +168.00 B (+0.1%) |
worker_threads.html |
414.90 KB | 414.73 KB | -168.00 B (-0.0%) |
module.html |
226.11 KB | 226.22 KB | +112.00 B (+0.0%) |
repl.html |
226.64 KB | 226.75 KB | +112.00 B (+0.0%) |
test.html |
1011.46 KB | 1011.40 KB | -56.00 B (-0.0%) |
Performance estimate (single CI run)
- Generation time: 5.4% slower (14.93 s → 15.74 s)
- Peak memory: 11.2% lower (1.36 GB → 1.21 GB)
legacy-json Generator
Performance estimate (single CI run)
- Generation time: 34.1% slower (6.45 s → 8.65 s)
- Peak memory: 2.1% higher (892.93 MB → 911.27 MB)
llms-txt Generator
Performance estimate (single CI run)
- Generation time: 35.0% slower (5.11 s → 6.90 s)
- Peak memory: 5.8% lower (952.15 MB → 896.66 MB)
orama-db Generator
Performance estimate (single CI run)
- Generation time: 33.9% faster (8.16 s → 5.39 s)
- Peak memory: 0.8% lower (1.02 GB → 1.02 GB)
web Generator
Output size: 45 files changed · net -54.17 KB
File size details
| File | Main | PR | Change |
|---|---|---|---|
addons.html |
390.53 KB | 362.73 KB | -27.80 KB (-7.1%) |
embedding.html |
73.32 KB | 68.68 KB | -4.63 KB (-6.3%) |
process.html |
1.20 MB | 1.20 MB | -4.16 KB (-0.3%) |
child_process.html |
707.46 KB | 705.21 KB | -2.24 KB (-0.3%) |
tls.html |
559.10 KB | 561.28 KB | +2.18 KB (+0.4%) |
fs.html |
2.36 MB | 2.36 MB | -1.32 KB (-0.1%) |
crypto.html |
2.11 MB | 2.11 MB | -1.21 KB (-0.1%) |
http.html |
1.25 MB | 1.25 MB | -1.11 KB (-0.1%) |
assert.html |
673.68 KB | 672.57 KB | -1.11 KB (-0.2%) |
util.html |
1.22 MB | 1.22 MB | -964.00 B (-0.1%) |
async_hooks.html |
293.79 KB | 292.92 KB | -898.00 B (-0.3%) |
http2.html |
1.36 MB | 1.36 MB | -788.00 B (-0.1%) |
readline.html |
381.81 KB | 381.04 KB | -788.00 B (-0.2%) |
buffer.html |
1.82 MB | 1.82 MB | -736.00 B (-0.0%) |
dgram.html |
314.37 KB | 313.65 KB | -728.00 B (-0.2%) |
vm.html |
657.72 KB | 657.06 KB | -680.00 B (-0.1%) |
webstreams.html |
566.06 KB | 565.40 KB | -674.00 B (-0.1%) |
perf_hooks.html |
913.52 KB | 912.92 KB | -620.00 B (-0.1%) |
cluster.html |
318.50 KB | 317.90 KB | -616.00 B (-0.2%) |
worker_threads.html |
657.04 KB | 656.47 KB | -588.00 B (-0.1%) |
zlib.html |
1.02 MB | 1.02 MB | -508.00 B (-0.0%) |
ffi.html |
217.71 KB | 217.22 KB | -504.00 B (-0.2%) |
test.html |
1.48 MB | 1.48 MB | -458.00 B (-0.0%) |
globals.html |
347.43 KB | 347.04 KB | -394.00 B (-0.1%) |
vfs.html |
214.50 KB | 214.17 KB | -340.00 B (-0.2%) |
url.html |
536.62 KB | 536.29 KB | -338.00 B (-0.1%) |
stream_iter.html |
798.56 KB | 798.28 KB | -296.00 B (-0.0%) |
v8.html |
601.27 KB | 600.99 KB | -294.00 B (-0.0%) |
async_context.html |
330.58 KB | 330.35 KB | -234.00 B (-0.1%) |
n-api.html |
1.06 MB | 1.06 MB | -230.00 B (-0.0%) |
dns.html |
443.11 KB | 442.89 KB | -224.00 B (-0.0%) |
sqlite.html |
559.94 KB | 559.77 KB | -174.00 B (-0.0%) |
domain.html |
131.70 KB | 131.53 KB | -168.00 B (-0.1%) |
quic.html |
995.95 KB | 995.78 KB | -168.00 B (-0.0%) |
stream.html |
1.28 MB | 1.28 MB | -122.00 B (-0.0%) |
repl.html |
314.72 KB | 314.60 KB | -116.00 B (-0.0%) |
modules.html |
239.11 KB | 239.00 KB | -112.00 B (-0.0%) |
tty.html |
114.29 KB | 114.18 KB | -112.00 B (-0.1%) |
bench.html |
243.97 KB | 243.91 KB | -60.00 B (-0.0%) |
cli.html |
691.78 KB | 691.72 KB | -56.00 B (-0.0%) |
permissions.html |
96.40 KB | 96.35 KB | -56.00 B (-0.1%) |
module.html |
360.84 KB | 360.83 KB | -14.00 B (-0.0%) |
esm.html |
198.27 KB | 198.26 KB | -8.00 B (-0.0%) |
single-executable-applications.html |
188.49 KB | 188.48 KB | -2.00 B (-0.0%) |
wasi.html |
84.34 KB | 84.34 KB | -2.00 B (-0.0%) |
Performance estimate (single CI run)
- Generation time: 23.7% slower (16.66 s → 20.61 s)
- Peak memory: 15.2% lower (1.70 GB → 1.44 GB)
2b215f2 to
ad1a970
Compare
|
Ack, the alias keys are lowercased now, with a test |
269a455 to
891436d
Compare
891436d to
15a06e7
Compare
|
cc @avivkeller could you review? |
So peak memory can be noisy, yes... This wasn't the ideal measurement to show on the PR 😅 But loading few grammars (aliasing supersets of them) reduces the amount of memory Shiki is loading. Some of these grammars use quite a good chunk of memory. Let me update the PR description with some more runs. Let me actually run this PR on top of my performance stack that should be less noisy and also give you numbers on how much each one of these grammars use in terms of memory. |
b570722 to
5c2b0e2
Compare
|
@avivkeller updated the description: 7 runs each now and every row's lower, on top of the stack too. C++'s grammar alone is ~98MB per thread, JS ~20MB :) |
Each grammar costs every thread its own memory, about 60MB for JavaScript's on Oniguruma, and time to register. Types and signatures are already highlighted as TypeScript, whose grammar highlights JavaScript too, so `js`, `mjs`, `cjs` and `javascript` code is now highlighted with it by default, and C++ (`cpp`, `c++`) with C's. On Node.js's docs that saves ~190MB of peak memory and 2-7% of build time. In the light theme, the default, JavaScript comes out the same but for one block of console output marked as `js`. Nord, the dark theme, has a few colors only for JavaScript's scopes. C++-only keywords lose their color. `langAlias` takes precedence, and doc-kit now resolves aliases itself: Shiki replaced configured aliases with a grammar's own as it registered. Aliases now also lead on through other aliases and are found in any case. Transformers, and the language `resolveLanguage` returns, are the one code is highlighted as. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: Claude Sonnet 5.5 <noreply@anthropic.com>
The lookup lowercased the language, but the aliases kept their keys as
written, so `{ MyConf: 'ini' }` never matched. They're keyed in
lowercase now. The test also says why Rust stands in for a bundled
language registered through its own alias.
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Following aliases always ended, since each one is followed once, but the set of those followed kept the names as written while the lookup lowercased them, so it took a second look to see. Both use the lowercased name now, and the test adds a cycle that differs only in case. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
The cycle differing only in case checked nothing the other cycle doesn't: following aliases ended before tracking them by their lowercased name too, which only made it easier to see. A capitalised key is checked once, the conf alias is highlighted as ini in the test of configured languages already, and the test of configured aliases over the default ones keeps C++, as the test of a language of langs checks JavaScript's. The comment on Rust no longer says "now". Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
From the review. resolveLanguage now reads the language its aliases lead to from followAliases, which follows each configured alias once, and takes the default alias when none applies. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
69ad107 to
d6a7712
Compare
Description
This PR highlights code with fewer grammars by default, as each one takes its own memory on every thread that highlights code. JavaScript (
js,mjs,cjs,javascript) now uses TypeScript's grammar, and C++ (cpp,c++) uses C's. In the light theme JavaScript looks the same, and Nord loses a few colors only JavaScript's grammar gives.langAliastakes precedence, so{ cpp: 'cpp' }brings C++'s own grammar back.doc-kit now resolves aliases itself, since Shiki replaced configured ones with a grammar's own as it registered it, so aliases also follow other aliases and match in any case.
Highlighting the Node.js docs' 2,866 JavaScript, TypeScript, C and C++ blocks in one process, JavaScript's own grammar takes +20MB RSS and C++'s +98MB, +119MB for both as on
main(5 runs each, within ±2MB).Full Node.js docs, medians of 7 interleaved runs (5 with one thread):
mainPeaks vary by ~100MB between runs, so the -2% rows are within that. On top of #1243, the site build is 3-4% faster with 8-10% less peak memory.
Validation
Added tests for highlighting JavaScript as TypeScript and C++ as C, configured aliases taking precedence, following aliases in any case, and an alias leading to a language of
langs.Related Issues
Split out of #1205.
Check List
node --run testand all tests passed.node --run format:check&node --run lint.