Repository navigation
Chart loading: preload the module graph, warm exchange connections, stop reading the bars twice a beat - #9
Merged
Conversation
…s, stop reading the bars twice a beat Measured with one tab open and the exchange mocked (localhost, headless Chromium): - the ES-module graph (workspace -> Vela, vela-pinets, PineTS, ~140 Zag files) was found one import level at a time: 17 sequential waves, ~1.3 s of a 1.8 s boot. index.html now lists all 157 as modulepreload, generated by tools/modulepreload.py (--write after a vendor upgrade; --check runs in the suite). First canvas 1,798 -> 1,586 ms; with 80 ms per request 3,372 -> 2,844 ms. The block sits after the import map: before it, the map freezes empty and the workspace falls back to the bare chart (found by checking the workspace really loaded) - preconnect to api.binance.com / fapi.binance.com / the icon host, so the handshakes overlap the module graph - the heartbeat read the bars twice every 4 s, each a live venue fetch via /api/bars when the chart hands none over: 16 in 30 idle seconds. One read; chartBars() shares one fetch between callers within 3 s; the server keeps a clean answer for 1.5 s. 16 -> 8 per 30 s. Empty, failed or partial answers are never kept - test_boot_speed.py (17 tests), each fix mutation-checked; full suite 1034 tests Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLsbckEp88WEwC41dfyMeS
|
Nothing flagged · reviewed Architecture Inside the changed components — 2 viewsComponent view — Frontend boot & preloading Preload link derivation and early TLS connection warmup for chart assets Component view — Market data caching Two-tier in-flight sharing and memory memoization for chart kline requests Data flow View
Tip The CLI's 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
godzillacode0000
added a commit
that referenced
this pull request
Oct 6, 2026
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.
Summary
Measured with one tab open and the exchange mocked (localhost, headless Chromium, no real GPU or Binance). The gains are real but modest on localhost; the module-graph one grows with request latency.
index.htmlnow lists all 157 as<link rel="modulepreload">, generated bytools/modulepreload.py(--writeafter a vendor upgrade; the suite runs--check, so a stale list fails there).preconnect(api.binance.com, fapi.binance.com, the icon host), so the TLS handshakes overlap the module graph. Not measurable offline./api/bars: 16 in 30 idle seconds → 8. It reads once;chartBars()shares one fetch between callers within 3 s; the server keeps a clean answer for 1.5 s. Empty, failed and partial answers are never kept; every caller gets its own array.Notes for review
full workspace failedlog) in every A/B run.test_boot_speed.pypins the order.vendor/vela/dist/workspace.jsshares a file name with the page's entryworkspace.js; the entry is compared by path.exchangeInfodownloads at boot, Vela's endpoint ping (vendored code), and theno-storeheaders (no measurable gain here).Testing
test_boot_speed.py, 17 tests: the block equals what the generator derives; it comes after the import map; every listed file exists and the whole graph is covered; preconnects present; one bars read per heartbeat; the shared-fetch behaviour (concurrent, within window, expiry, separate markets, independent arrays, empty/failed never kept); the server memo (hit, separate keys, expiry, failed and partial never kept, bounded size). Each fix mutation-checked.🤖 Generated with Claude Code
https://claude.ai/code/session_01GLsbckEp88WEwC41dfyMeS
Generated by Claude Code