Skip to content

perf(effect): lazily initialize HTTP API routes - #593

Merged
Makisuo merged 1 commit into
mainfrom
perf/api-lazy-http-routes
Aug 23, 2026
Merged

perf(effect): lazily initialize HTTP API routes#593
Makisuo merged 1 commit into
mainfrom
perf/api-lazy-http-routes

Conversation

@Makisuo

@Makisuo Makisuo commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Compile each Effect HTTP endpoint's codecs and middleware on the first request to that route.
  • Generate Scalar, Swagger, and openapiPath responses lazily and memoize only successful builds.
  • Retry endpoint/documentation initialization after construction defects instead of poisoning the runtime.

Benchmark

Five fresh-workerd request runs, median:

  • GET /health: 202.3 ms → 125.6 ms (-37.9%).
  • Unauthenticated GET /v2/services: 207.3 ms → 129.0 ms (-37.8%).
  • Upload-time startup CPU is intentionally unchanged (114.2 ms → 117.8 ms, sampling noise); this layer moves route construction, not the static module graph.

Verification

  • Vendored Effect HTTP API tests: 48 passed.
  • API and domain typechecks passed in the complete stack.

Stack: 1/3. Followed by #594 and #595.

Stack created with GitHub Stacks CLIGive Feedback 💬

@Makisuo
Makisuo marked this pull request as ready for review August 23, 2026 13:18

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@Makisuo
Makisuo merged commit a9f8e3e into main Aug 23, 2026
25 checks passed
@Makisuo
Makisuo deleted the perf/api-lazy-http-routes branch August 23, 2026 14:00
@Makisuo
Makisuo deployed to pr-preview August 23, 2026 14:00 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

🍁 Maple PR preview

Note

Preview resources were removed when this pull request closed.

Final commit 3d3ccba · View workflow run

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