Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ability to create and load a snapshot without rebuilding the whole binary #19399

Closed
bartlomieju opened this issue Jun 7, 2023 · 1 comment · Fixed by #20048
Closed

Ability to create and load a snapshot without rebuilding the whole binary #19399

bartlomieju opened this issue Jun 7, 2023 · 1 comment · Fixed by #20048
Assignees
Labels
build build system or continuous integration related deno_core Changes in "deno_core" crate are needed perf performance related refactor

Comments

@bartlomieju
Copy link
Member

In an effort to improve iteration time when working only on JavaScript code,
we should consider having a way to rebuild and load the startup snapshot without
having to rebuild the whole binary.

This would be done by a combination of a Cargo feature flag (or env variable) to
instruct the cargo build process to not include the snapshot in the binary, and
a separate script that would be able to build the snapshot on demand.

This might require building a separate binary that would have a sole purpose of
building the snapshot (akin to V8's mksnapshot binary used to produce initial
snapshot with JS built-ins).

There is a challenge related to the fact that we currently snapshot "ops" that are
included in the binary, but it doesn't seem insurmountable.

@bartlomieju bartlomieju self-assigned this Jun 7, 2023
@bartlomieju bartlomieju added build build system or continuous integration related perf performance related deno_core Changes in "deno_core" crate are needed refactor labels Jun 7, 2023
@k-nasa
Copy link
Contributor

k-nasa commented Jun 14, 2023

Last week, I faced this issue while working on the code for ext/node/polyfills. Each change required a lengthy build time. It would be tremendously helpful and significantly increase our development efficiency if we could reduce this time to just a few seconds. I fully support this proposal 😄

bartlomieju pushed a commit that referenced this issue Aug 5, 2023
Closes #19399 (running without snapshots at all was suggested as an
alternative solution).

Adds a `__runtime_js_sources` pseudo-private feature to load extension
JS sources at runtime for faster development, instead of building and
loading snapshots or embedding sources in the binary. Will only work in
a development environment obviously.

Try running `cargo test --features __runtime_js_sources
integration::node_unit_tests::os_test`. Then break some behaviour in
`ext/node/polyfills/os.ts` e.g. make `function cpus() {}` return an
empty array, and run it again. Fix and then run again. No more build
time in between.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
build build system or continuous integration related deno_core Changes in "deno_core" crate are needed perf performance related refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants