Repository navigation
Conversation
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 10:31
3708174 to
534c841
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 11:16
534c841 to
d379e06
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 11:20
d379e06 to
fa0c62a
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 12:27
fa0c62a to
27e8227
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 12:44
27e8227 to
79b57f8
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
2 times, most recently
from
November 17, 2026 13:13
1b93ec2 to
c4a7475
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 13:20
c4a7475 to
4d399f1
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
2 times, most recently
from
November 17, 2026 13:44
910d218 to
c02663c
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 15:28
c02663c to
3abbf3c
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 16:26
3abbf3c to
f262e01
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 16:42
f262e01 to
4204d72
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
3 times, most recently
from
November 17, 2026 17:30
e2797b0 to
a220108
Compare
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
2 times, most recently
from
November 17, 2026 22:21
2ceeb47 to
4fc7e54
Compare
Assisted-by: Claude (Opus 5.5 Medium)
Assisted-by: Claude (Opus 5.5 Medium)
Assisted-by: Claude (Opus 5.5 Medium)
allozaur
force-pushed
the
allozaur/perf/ui-import-cost
branch
from
November 17, 2026 22:35
4fc7e54 to
593f18a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Llama Chat downloads a quarter less JavaScript when it starts (2.93 MB -> 2.18 MB gzipped), and its unit tests and dev server start much faster. The app's own barrel imports stay: measured, they cost nothing in the shipped bundle.
Additional information
Part 11 of 13 of the work-in-progress stack on the fork, under Pele (#75), based on
allozaur/refactor/ui-typed-routes(#73).Full write-up with the bundle breakdown: https://claude.ai/artifact/FDY5n7ssJgorp5NoBnE1rG
Cause
The question was whether importing through barrels (
import { chatStore } from '#lib/stores/index.ts', about 760 of them) costs anything. It doesn't in the build: rebuilding with everysrc/libmodule declared free of side effects changed the bundle by 2.9 KB out of 10 MB, since everything the barrels re-export is used somewhere andbundleStrategy: 'single'ships all reachable code anyway. The costs were elsewhere:@lucide/svelte's barrel in Node. Twelve.tsmodules imported icons as{ Globe } from '@lucide/svelte', which re-exports ~1,700 icons. The browser gets it prebundled; Node (Vitest's unit project, and the dev server, which loads a route's+page.tsin Node) resolves, compiles and runs every icon. Through#lib/constants/index.tsnearly every unit test paid ~4.5 s for it, and the dev server took 4.7 s to answer/.import hljs from 'highlight.js'loads the package's CommonJS build with all 192 languages; lowlight, used by the Markdown pipeline, loads the ES build of the same languages. 861 KB + 859 KB.?rawand turned into a Blob URL on every start; nerdamer (472 KB) was a string in a virtual module. Undersingleboth shipped with the bundle every page load downloads. The?rawimport comes from the first SvelteKit web UI, whoseinlinestrategy allowed no separate files.What changed
.tsmodules import each icon from its own path (import Globe from '@lucide/svelte/icons/globe'), as Lucide recommends. The 165.sveltefiles keep the barrel: converting them saved ~0.7 s more on a cold dev start and nothing warm or in tests.utils/code.tsimportshighlight.js/lib/coreand registers lowlight's language modules on it: the same languages, one copy.?url), which pdf.js starts when it first opens a PDF. nerdamer is emitted as its own file in the client build and fetched when the sandbox first needs it; dev and tests still get the string. Both sit in_app/immutable/assets, which the service worker precaches, so they work offline.scripts/ui-assets.cmakemaps.mjstoapplication/javascript, which module workers require. llama-server already embeds and serves every file indist; the npx CLI already maps.mjs.Numbers
On localhost boot time doesn't change (~0.95 s); the gain is bytes on the wire, for llama-server opened over the LAN or Tailscale. The client and Storybook test projects run where Vite prebundles dependencies, and their times didn't change.
Not in this PR:
splitinstead ofsingle: measured on the code before this PR, first-load JS would go from 10.09 MB to 6.33 MB raw (2.95 -> 1.90 MB gzip), mostly Mermaid, which is already behindimport().singlewas chosen when the build output was committed to the repo (server: (webui) no more gzip compression ggml-org/llama.cpp#21073); it no longer is. It would need thebundle*.js/bundle*.csscheck inui-assets.cmakechanged and embeds ~120 files instead of a handful. Splitting by route gains nothing: the root layout reaches most of the app.commonset (36 languages) would save ~1.47 MB more, but changes which code blocks get colored.Testing
ui/apps/chat:npm run check(0 errors),npm run lint, the 1085 unit tests, the Storybook tests (115 files, 251 tests) andnpm run buildpass.Context "Tooltip.Provider" not founderrors fromdialog-focus-mobileshow up on ui: navigate through resolve() with typed route ids #73 too.diff(sin(x)/x, x)correctly.scripts/ui-assets.cmakeon thisdist(gzip on) embeds 82 assets, with the worker (.mjs) and nerdamer asapplication/javascript. Not checked in a running llama-server.Requirements
Claude (Opus 5.5 Medium)