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
Create benchmarks using bun #7646
Comments
Yes, would love other JavaScript and TypeScript engines compared here: deno and bun. Also zig (which bun is written in) as a language is also missing. |
I built one real quick this weekend here: #8407 Once Bun 1.0 is released will update it to that. Would love any feedback as I don't know if I fully optimized it or not. |
Edit: spawn.ts import os from 'node:os';
const numCPUs = os.availableParallelism();
for (let i = 0; i < numCPUs; i++) {
Bun.spawn(['bun', 'src/index.ts'], {
stdio: ['inherit', 'inherit', 'inherit'],
env: { ...process.env },
});
} index.ts Bun.serve({
port: 8080,
reusePort: true, // allow Bun server instances to use same port
fetch(req: Request) {
// ... An example using Elysia.js import { Elysia } from 'elysia';
const app = new Elysia({
serve: {
reusePort: true,
},
})
.get('/', () => 'Hello Elysia')
.listen(8080);
console.log(
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
); run |
Bun does have mutlithreading with the |
@masfahru Does this example also load balance to each process somehow? If so, does anyone know how that mechanism works? |
It doesn't. Node wrote their own into their stuff https://nodejs.org/api/cluster.html Bun.js doesn't support that yet but you probably could add a simple one oven-sh/bun#2428 as at least then you are comparing apples to apples. |
the deno version - https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/TypeScript/deno/src/main.ts
FYI @Jarred-Sumner
The text was updated successfully, but these errors were encountered: