Skip to content

feat(compiler): complete functionality to match findRoute #158

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2025
Merged

Conversation

aquapi
Copy link
Contributor

@aquapi aquapi commented Jun 15, 2025

Resolves #157

Copy link

codecov bot commented Jun 15, 2025

Codecov Report

Attention: Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/compiler.ts 95.83% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@aquapi aquapi marked this pull request as ready for review June 16, 2025 01:48
@aquapi aquapi requested a review from pi0 as a code owner June 16, 2025 01:48
@pi0 pi0 changed the title Complete compiler functionality feat(compiler): complete functionality to match findRoute Jun 16, 2025
@pi0 pi0 merged commit f40d606 into h3js:main Jun 16, 2025
2 of 3 checks passed
@pi0 pi0 mentioned this pull request Jun 16, 2025
11 tasks
@pi0
Copy link
Member

pi0 commented Jun 16, 2025

Amazing!! One small note, it seems we have duplicate checks for static routes: https://gist.github.com/pi0/11d46d20da673b849c40095328c81945#file-rou3-compiled-mjs-L29-L33

@pi0
Copy link
Member

pi0 commented Jun 16, 2025

fixed in db9fcf2

results after:

runtime: bun 1.2.15 (arm64-darwin)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
• dynamic routes
------------------------------------------- -------------------------------
findRoute                    227.10 ns/iter 230.40 ns 278.70 ns ▁▁▂▂▃█▁▁▁▁▁
compileRouter                 91.22 ns/iter  90.99 ns 130.20 ns ▂▃█▁▁▁▁▁▁▁▁

summary
  compileRouter
   2.49x faster than findRoute

• all routes
------------------------------------------- -------------------------------
findRoute                    198.01 ns/iter 198.38 ns 253.48 ns ▂▂██▁▁▁▁▁▁▁
compileRouter                114.05 ns/iter 113.77 ns 153.76 ns ▁▂█▂▁▁▁▁▁▁▁

summary
  compileRouter
   1.74x faster than findRoute
runtime: deno 2.3.5 (aarch64-apple-darwin)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
• dynamic routes
------------------------------------------- -------------------------------
findRoute                    333.99 ns/iter 336.85 ns 375.26 ns ▁▁▂▄█▃▁▁▁▁▁
compileRouter                145.53 ns/iter 147.13 ns 180.18 ns ▁▁▅█▅▂▁▁▁▁▁

summary
  compileRouter
   2.3x faster than findRoute

• all routes
------------------------------------------- -------------------------------
findRoute                    353.56 ns/iter 356.40 ns 452.68 ns ▁▃█▃▁▁▁▁▁▁▁
compileRouter                170.86 ns/iter 173.13 ns 210.43 ns ▁▁▃█▄▂▂▁▁▁▁

summary
  compileRouter
   2.07x faster than findRoute
runtime: node 22.13.0 (arm64-darwin)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
• dynamic routes
------------------------------------------- -------------------------------
findRoute                    346.32 ns/iter 352.72 ns 387.33 ns ▁█▄▂▅▁▁▁▁▁▁
compileRouter                145.06 ns/iter 151.06 ns 170.00 ns ▁█▇▂▁▅▂▁▁▁▁

summary
  compileRouter
   2.39x faster than findRoute

• all routes
------------------------------------------- -------------------------------
findRoute                    369.16 ns/iter 376.76 ns 390.36 ns ▁▁▁▄█▂▁▄▂▁▁
compileRouter                172.51 ns/iter 178.32 ns 201.11 ns █▄▃▂▆▂▂▁▁▁▁

summary
  compileRouter
   2.14x faster than findRoute

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.

Full functionality (pnpm test:compiler)
2 participants