Skip to content

Instantly share code, notes, and snippets.

@eins78
Created February 27, 2026 13:06
Show Gist options
  • Select an option

  • Save eins78/ae505510bf7aef845ab02240d7182797 to your computer and use it in GitHub Desktop.

Select an option

Save eins78/ae505510bf7aef845ab02240d7182797 to your computer and use it in GitHub Desktop.
E2E benchmark: websmith PR #109 + magellan PR #147 — transpileModule fast path (89.4s → 0.88s, 101x speedup)

E2E: transpileModule Fast Path v2 (websmith PR #109 + magellan PR #147)

2026-02-27T12:57:56Z by Showboat 0.6.1

What Changed

Two coordinated PRs optimize magellan compile --client in cpq-cds:

PR Repo Branch Changes
#109 websmith feature/transpile-module-fast-path transpileModule fast path + transpileOnly guards for declaration checks
#147 qs-magellan feature/disable-declarations-for-client needsTypeInfo = false on client addon + declaration: false in CLI client profile

websmith changes (Compiler.ts)

  1. Fast path infrastructure (commits 672d3de..c737617): Skip ts.createProgram() when no addon needs type info and no declarations needed
  2. transpileOnly declaration guard (commit 3fbf4e5): shouldUseTranspileModuleFastPath() returns true when transpileOnly is enabled even if declaration: true — because ts.transpileModule() cannot produce .d.ts files
  3. Per-file Program guard (commit 3fbf4e5): transpileSourceCode() skips per-file Program creation when transpileOnly is enabled

magellan changes (PR #147)

  1. needsTypeInfo = false on client-function-transform addon — opts the addon into the fast path
  2. declaration: false in CLI client profile builder — client proxies are runtime code, declarations not needed

Method

  1. Baseline: 3 runs of magellan compile --client with stock dependencies (magellan 0.19.2 + websmith 0.8.5)
  2. Build & patch: Built websmith from PR branch, rebuilt magellan CLI webpack bundle with patched websmith + PR #147 changes
  3. Patched: 3 runs with combined changes
  4. Verified: Debug output confirms fast path activation

Environment

  • Machine: MacBook Pro (Apple Silicon)
  • Node.js: v25.6.1
  • cpq-cds: 77 source files in packages/service-proxies
  • Clean lib/ directory before each run

Dependency chain

cpq-cds/packages/service-proxies
  postinstall: magellan compile --client --addonsDir ./node_modules/@quatico/magellan-addons/lib
    @quatico/magellan-cli@0.19.2 (webpack-bundled bin/magellan.js)
      @quatico/websmith-core@0.8.5   <- patched

Note: magellan-cli bundles all dependencies into bin/magellan.js via webpack (~53K lines). Patching individual node_modules has no effect — the full CLI must be rebuilt.

Results

Baseline (stock websmith 0.8.5 + magellan 0.19.2)

Run 1:  90.18 real       113.66 user        14.79 sys
Run 2:  89.15 real       112.50 user        14.65 sys
Run 3:  88.88 real       110.30 user        14.78 sys
Avg:   ~89.4s wall

Patched (websmith PR #109 + magellan PR #147)

Run 1:   0.89 real         1.50 user         0.11 sys
Run 2:   0.88 real         1.50 user         0.11 sys
Run 3:   0.88 real         1.50 user         0.11 sys
Avg:   ~0.88s wall

Summary

Metric Baseline Patched Speedup
Avg wall time 89.4s 0.88s 101x
Avg user time 112.2s 1.50s 75x
Avg sys time 14.7s 0.11s 134x

Verification

Debug output confirms fast path activation:

[INFO] Using fast transpileModule path (no addons require type information, no declarations).

Output: 154 files (77 .js + 77 .js.map) in flat lib/ directory. No .d.ts files (expected — declaration: false in client profile). Output path structure differs from stock (flat vs nested) — this is expected behavior.

How It Works

The optimization eliminates two expensive operations:

  1. Full Program creation (~40s): ts.createProgram() builds the complete type graph for 77 source files + all transitive dependencies. With the fast path, program = undefined.
  2. Per-file Program creation (~45s): transpileSourceCode() was creating per-file Programs for declaration generation, even when transpileOnly mode makes declarations impossible. Guard added: declaration && !this.transpileOnly.

What remains: ts.transpileModule() per file (~10ms each), addon processor execution, and result processing.

All Tests Pass

websmith test suite (after Compiler.ts changes):

@quatico/websmith-api        — 6 suites, all passed
@quatico/websmith-core       — 29 suites, all passed
@quatico/websmith-compiler   — 2 suites, all passed
websmith-loader              — 3 suites, all passed
@quatico/websmith-testing    — 1 suite, all passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment