Skip to content

perf(extension): load the compiled entrypoint directly - #178

Open
gurronen wants to merge 1 commit into
QuintinShaw:mainfrom
gurronen:perf/compiled-extension-entry
Open

perf(extension): load the compiled entrypoint directly#178
gurronen wants to merge 1 commit into
QuintinShaw:mainfrom
gurronen:perf/compiled-extension-entry

Conversation

@gurronen

@gurronen gurronen commented Aug 31, 2026

Copy link
Copy Markdown

Summary

  • avoid transpiling the workflow extension's TypeScript graph during every Pi startup

Changes

  • compile the Pi extension entrypoint with the existing TypeScript build
  • point pi.extensions at dist/pi-extension.js
  • replace the extension's package-barrel import with direct module imports
  • verify the compiled entrypoint is included in the npm package and exports an extension factory

Testing

  • npm test
  • npm pack --dry-run --json
  • manual pi -e .
  • startup benchmark before/after

Startup benchmark

Measured in a fresh Bubblewrap sandbox per run, with networking disabled, an empty temporary home/cache, all normal Pi extension/skill/theme/context loading disabled, and only this extension explicitly enabled. One warm-up was discarded and 10 alternating runs were recorded.

Case Entrypoint Median Range
Without PR (4aaf451) extensions/workflow.ts 1.941s 1.505–2.245s
With PR (f3a3de9) dist/pi-extension.js 0.949s 0.784–1.094s
Pi control, no extension 0.234s 0.220–0.261s

The compiled entrypoint reduced median total startup by 0.991s (51.1%), or 2.04×. Relative to the no-extension control, median extension overhead fell from approximately 1.707s to 0.715s (58.1%).

@gurronen
gurronen marked this pull request as ready for review August 31, 2026 14:55
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