Repository navigation
perf: faster app startup - #18
Open
bajrangCoder wants to merge 7 commits into
Open
bajrangCoder wants to merge 7 commits into
bajrangCoder wants to merge 7 commits into
Conversation
- Reveal the app after its first rendered frame instead of a fixed 500 ms delay - Run independent native startup calls and the purchase check in parallel - Bound the startup purchase check so an unresponsive store cannot hold the splash screen - Load the terminal, run/preview and mime-types code on demand - Target the oldest supported WebView/Safari instead of ES2015 - Cache the native encoding list, skip load-time validation of built-in themes - Rebuild the command keymap lazily and apply it once per burst - Load the built-in sidebar app chunks in parallel - Fix the owned plugins list crash and the unhandled sponsor form cancellation
native.js already installs core-js/stable and boot.js always loads it before main.js, so main.js no longer bundles a second copy (-113 KB).
- Decode and encode UTF-8 in the WebView instead of round-tripping base64 through native; invalid UTF-8, lone surrogates and other charsets still use native so behaviour is unchanged (BOM kept on Android, stripped on iOS) - Format Android internal file URLs in JS when the result provably matches native, skipping a resolve round trip per read and per plugin path - Load plugins with fewer native round trips: no exists() check for main, and the cache file and plugin token are prepared while the script loads - Open files shared from other apps after a short plugin grace period instead of waiting for every plugin; files a plugin may handle (remembered handler extensions, documents) still wait as before
- Move the language-server client (clientManager, editor features, @codemirror/lsp-client, marked, protocol types) into a chunk that loads only when an enabled server handles an open file, after the editor is visible; the plugin-facing registry and diagnostics UI stay in main.js - Load Emmet through a compartment only when a file uses an Emmet syntax - Start developer tools (eruda) after the editor is visible and replay the console output and errors captured during startup into its console - main.js: 1,895 KB -> 1,515 KB
Android's native long-press fires after our tap-hold timer and blurs the terminal, which closed the keyboard, resized the grid and made the selection menu disappear and reappear. Refocus in the same task so the IME never hides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Hide banners when a Pro purchase is confirmed after the startup check timed out, as purchase restoration does - Clear the cached Pro flag when the store reports no purchase, even if the result is too late to change this session - Wait for plugins before opening shared files until a full plugin load has recorded which extensions plugins handle (first launch after updating) - Cancel a pending developer tools initialization when developer mode is turned off, so Eruda does not activate afterwards - Move the startup purchase check into lib/verifyProPurchase.js
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
Makes the editor usable much sooner on Android and iOS, and keeps plugins, file I/O and optional features from slowing startup. App and plugin behaviour stay the same.
Results
Cold starts of a signed release on a Motorola Edge 40 Neo (Android 15) with a real set of installed plugins and developer mode on, plus the iPhone 17 Pro simulator (free edition).
main.js(Android / iOS)From tap to editor on the same Android device it is now ~1.15 s, including ~430 ms for Android to show the native splash and start the WebView.
Startup sequence
Smaller startup bundle
Code that is not needed for the first frame now loads on demand:
mime-types.@codemirror/lsp-client,markedand the protocol types. The plugin-facing server registry, the diagnostics UI and the server launcher stay eager.Polyfills are bundled once (
native.jsalways loads first). swc targets the oldest supported engine instead of ES2015 (chrome >= 67on Android,ios_saf >= 18on iOS), withcore-jsinentrymode so plugins still get every global.Less startup work
File I/O and plugins
Fixes
disabledMapscope).