Skip to content

perf(ext): convert ext/ffi JS source to lazy-loaded script#33780

Merged
bartlomieju merged 2 commits into
mainfrom
perf/lazy-loaded-ffi
May 3, 2026
Merged

perf(ext): convert ext/ffi JS source to lazy-loaded script#33780
bartlomieju merged 2 commits into
mainfrom
perf/lazy-loaded-ffi

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

Summary

Follow-up to #33760. Converts ext/ffi/00_ffi.js from ESM to an IIFE-wrapped lazy-loaded script (lazy_loaded_js).

No cross-extension ESM deps -- only uses core.loadExtScript for already-converted ext/web.

Test plan

  • cargo build --bin deno succeeds
  • CI

@fibibot fibibot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tiny 3-file change following the established lazy_loaded_js conversion pattern from #33760 and the already-merged ext/web counterparts:

  • ext/ffi/00_ffi.js: standard IIFE wrap ((function () { ... })()), globalThis.__bootstrap for core/internals/primordials (matching ext/web/02_timers.js's established pattern), const { op_X } = core.ops for ops destructuring, return { ... } in place of export { ... }. No cross-extension ESM imports, so no internals symbol bridges needed — the PR body's claim is verifiable from the diff.
  • ext/ffi/lib.rs: esm = ["00_ffi.js"]lazy_loaded_js = ["00_ffi.js"]. Right shape.
  • runtime/js/90_deno_ns.js: import * as ffi from "ext:deno_ffi/00_ffi.js"const ffi = core.loadExtScript("ext:deno_ffi/00_ffi.js"). Sole consumer migration.

Unlike #33779 where the IIFE wrapper shifted line numbers in ext/os/30_os.js and broke permissions_trace's pinned :43:10 assertion, 00_ffi.js doesn't appear on any stack-trace-pinning test fixtures, so the same line-shift hazard doesn't apply here.

CI

99/114 success at this head, 12 in flight, 2 failures both unrelated to this PR's substance:

  • test node_compat (2/3) debug windows-x86_64: parallel/test-dns-resolver-max-timeout.js: timeout1: 508, timeout2: 515 — the same Windows DNS-timing flake that's hit ~half the daily PRs (millisecond-granular > assertion against OS scheduler jitter). Pre-existing.
  • test specs (1/2) debug macos-aarch64: specs::upgrade::out fails on GitHub returning HTTP 502 ("Unicorn!") for https://github.com/denoland/deno/releases/download/v1.43.2/deno-aarch64-apple-darwin.zip. GitHub Releases infra hiccup, not deno code.

Neither is reproducible from substance.

@bartlomieju
bartlomieju merged commit bc1f7ff into main May 3, 2026
268 of 270 checks passed
@bartlomieju
bartlomieju deleted the perf/lazy-loaded-ffi branch May 3, 2026 07:38
bartlomieju added a commit that referenced this pull request May 4, 2026
… scripts (#33817)

- Convert `ext/process/40_process.js` from ESM to IIFE-wrapped
lazy-loaded script (`lazy_loaded_js`)
- Convert `ext/http/00_serve.ts`, `ext/http/01_http.js`,
`ext/http/02_websocket.ts` from ESM to IIFE-wrapped lazy-loaded scripts
- Update all consumers (`runtime/js/90_deno_ns.js`,
`runtime/js/99_main.js`, `ext/node/polyfills/child_process.ts`,
`ext/node/polyfills/internal/child_process.ts`) to use
`core.loadExtScript()` instead of ESM imports
- Replace `import.meta.log` calls with `internals.log` in `00_serve.ts`

Follows the same pattern established in #33778, #33780, #33784, #33800,
and #33801.
bartlomieju added a commit that referenced this pull request May 4, 2026
…ripts (#33818)

## Summary

- Convert `ext/kv/01_db.ts` from ESM to IIFE-wrapped lazy-loaded script
(`lazy_loaded_js`)
- Convert `ext/webgpu/00_init.js` from ESM to IIFE-wrapped lazy-loaded
script (`lazy_loaded_js`)
- Update all consumers (`runtime/js/90_deno_ns.js`,
`runtime/js/98_global_scope_shared.js`,
`runtime/js/98_global_scope_window.js`,
`runtime/js/98_global_scope_worker.js`) to use `core.loadExtScript()`
instead of ESM imports
- Replace `import.meta.log` call with `internals.log` in `01_db.ts`

Follows the same pattern established in #33778, #33780, #33784, #33800,
#33801, and #33817.
littledivy pushed a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
…33780)

Follow-up to denoland#33760. Converts `ext/ffi/00_ffi.js` from ESM to an
IIFE-wrapped lazy-loaded script (`lazy_loaded_js`).

Signed-off-by: Bartek Iwańczuk <[email protected]>
littledivy pushed a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
… scripts (denoland#33817)

- Convert `ext/process/40_process.js` from ESM to IIFE-wrapped
lazy-loaded script (`lazy_loaded_js`)
- Convert `ext/http/00_serve.ts`, `ext/http/01_http.js`,
`ext/http/02_websocket.ts` from ESM to IIFE-wrapped lazy-loaded scripts
- Update all consumers (`runtime/js/90_deno_ns.js`,
`runtime/js/99_main.js`, `ext/node/polyfills/child_process.ts`,
`ext/node/polyfills/internal/child_process.ts`) to use
`core.loadExtScript()` instead of ESM imports
- Replace `import.meta.log` calls with `internals.log` in `00_serve.ts`

Follows the same pattern established in denoland#33778, denoland#33780, denoland#33784, denoland#33800,
and denoland#33801.
littledivy pushed a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
…ripts (denoland#33818)

## Summary

- Convert `ext/kv/01_db.ts` from ESM to IIFE-wrapped lazy-loaded script
(`lazy_loaded_js`)
- Convert `ext/webgpu/00_init.js` from ESM to IIFE-wrapped lazy-loaded
script (`lazy_loaded_js`)
- Update all consumers (`runtime/js/90_deno_ns.js`,
`runtime/js/98_global_scope_shared.js`,
`runtime/js/98_global_scope_window.js`,
`runtime/js/98_global_scope_worker.js`) to use `core.loadExtScript()`
instead of ESM imports
- Replace `import.meta.log` call with `internals.log` in `01_db.ts`

Follows the same pattern established in denoland#33778, denoland#33780, denoland#33784, denoland#33800,
denoland#33801, and denoland#33817.
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.

2 participants