Skip to content
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

Add HatTip to Bun HTTP benchmark #114

Open
redbar0n opened this issue Jan 5, 2024 · 2 comments
Open

Add HatTip to Bun HTTP benchmark #114

redbar0n opened this issue Jan 5, 2024 · 2 comments

Comments

@redbar0n
Copy link
Contributor

redbar0n commented Jan 5, 2024

Would be nice to see HatTip at https://github.com/SaltyAom/bun-http-framework-benchmark

Related issue: SaltyAom/bun-http-framework-benchmark#58

@cyco130
Copy link
Member

cyco130 commented Jan 10, 2024

Ugh, this is a fairly useless benchmark.

For example, Hono on Bun looks like it performs badly. But just go to src/bun/hono.ts and change the export to export default { ...app, host: '127.0.0.1' } (instead of export default app) for an instant 20% speed boost that puts it right up, near the top.

If you're curious, with the above trick, Hattip on Bun performs a bit better than Hono without the trick. If I change the URL parser from new URL to something manual with indexOf and the query parser to a simple regex-based one, it catches up with Hono with the trick. You can go even faster by using other tricks like creating the same "Hi" response once and using clone to duplicate it and creating the options objects once and reusing them. Using a Headers object also seems to be faster. I really don't see much point but I'm designing a new router in any case. I will submit it once it's done anyway.

Also, exercising the same code path repeatedly like in here will show very different performance characteristics compared to a more realistic load profile.

I'll try to find better tools for load testing.

@redbar0n
Copy link
Contributor Author

redbar0n commented Mar 8, 2024

Maybe it'd be an idea to add HatTip to the Web Frameworks Benchmark too.

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

No branches or pull requests

2 participants