Skip to content

QuickJS Bundle Size Metrics Report#3

Draft
yumin-chen wants to merge 1 commit intomasterfrom
bundle-size-metrics-6500714725170663585
Draft

QuickJS Bundle Size Metrics Report#3
yumin-chen wants to merge 1 commit intomasterfrom
bundle-size-metrics-6500714725170663585

Conversation

@yumin-chen
Copy link
Copy Markdown
Owner

This submission contains the findings from measuring the bundle size reduction of QuickJS when using Link Time Optimization (LTO) and various -fno-* flags.

Key metrics for hello.js (stripped):

  • Baseline (no LTO): 1,022,320 bytes
  • Baseline (with LTO): 948,456 bytes
  • Partial Runtime (-fno-eval -fno-regexp -fno-json -fno-module-loader): 628,968 bytes (~33.7% reduction)
  • Minimal Runtime (all features disabled): 469,208 bytes (~50.5% reduction)

The reduction in partial runtime is primarily due to the linker stripping the JavaScript compiler and parser, which are no longer reachable at runtime when eval and the module loader are disabled.


PR created automatically by Jules for task 6500714725170663585 started by @yumin-chen

Collected metrics for baseline, partial, and minimal runtime configurations
using examples from the /examples directory. Confirmed that LTO successfully
removes the parser/compiler when eval and module-loader are disabled.
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@yumin-chen
Copy link
Copy Markdown
Owner Author

Parser and compiler will always be needed as build-time dev toolchain, but they're not always needed for runtime embedding for qjsc. However, currently quickJS bundles the full engine, including the parser and compiler to its runtime-only binary executable too when using qjsc, which introduces unnecessary runtime dependencies that could safely be removed to reduce bundle size while keeping the runtime-only binary executable fully functional -- while the built-time dev toolchain having full engine.

We need to find the conditions on which the parser/compiler truly is safe to be removed from runtime.

When -fno-eval -fno-regexp -fno-json -fno-module-loader are enabled, they signal user intent to explicitly disable certain features from both runtime and build-time, meaning the entire engine full removal, and the user does not need these features either buildtime or runtime.

So a combination of all -fno-eval -fno-regexp -fno-json -fno-module-loader means simultaneously disabling all possibility/references where runtime parser/compiler is used, and we could further minimise the bundling size of qjsc by removing the parser/compiler from the runtime while still keeping the full engine available as dev toolchain.

Or is there some other dependencies on the runtime parser/compiler?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant