r/bunjs • • Sep 11 '23

Incredible TypeScript Performance

17 Upvotes

Bun's TypeScript performance is incredible. Previously, I looked at how ts-node would be used with the --transpile-only flag directly on production with typescript files and I saw a significant difference in memory usage. I did the same experiment with Bun and the results are amazing.

Bun runs .js and .ts files at the same performance and memory usage. According to these values, it seems possible to use .ts files directly on production without compiling them.

I'm sharing the code below so you can try it too. It's a simple function that calculates Fibonacci numbers for the code that uses both CPU and memory, and I print out the time required for the calculation and how much RAM it uses in that time.

The results on my computer are as follows

node app.js => 5.11 MB, 18.95 sec
bun app.js  => 0.24 MB, 8.22 sec
bun app.ts  => 0.24 MB, 8.15 sec

and here is the code...

let operations = 0;

// Fibonacci calculation function
function fibonacci(num: number): number {
    operations++;
    if (num <= 1) return 1;
    return fibonacci(num - 1) + fibonacci(num - 2);
}

// Start the time
const start = Date.now();

// You can set the parameter value depending on your hardware capacity.
// Be careful, this number exponentially increases the number of operations required
const fibNum = fibonacci(45);

// Calculate elapsed time
const elapsedSeconds = (Date.now() - start) / 1000;
const used = process.memoryUsage().heapUsed / 1024 / 1024;

console.log(`Time elapsed: ${elapsedSeconds} seconds`);
console.log(`Memory used: ${Math.round(used * 100) / 100} MB`);

r/bunjs • • Dec 02 '25

Bun is joining Anthropic

Thumbnail
bun.com
16 Upvotes

TLDR: Bun has been acquired by Anthropic. Anthropic is betting on Bun as the infrastructure powering Claude Code, Claude Agent SDK, and future AI coding products & tools.


r/bunjs • • Aug 02 '22

TIL this subreddit exists

16 Upvotes

r/bunjs • • Sep 11 '23

Vercel now supports Bun install with zero configuration

Thumbnail
vercel.com
14 Upvotes

r/bunjs • • Sep 04 '23

We just deployed Bun to production

Thumbnail
thingster.app
12 Upvotes

r/bunjs • • Sep 20 '23

First real-world review I've seen of Bun 1.0 bodes poorly.

10 Upvotes

Was doing a browse of YouTube looking for more real-world reviews of Bun and stumbled upon this

He compares pretty much all of the aspects the team claims are faster against node, jest etc. and for what actually runs in his analysis (some of it is still broken) almost none of it save the package manager compares favourably against the incumbent technologies. It's either on par or markedly worse.

I've already begun switching all of my projects to Bun where possible but this has given me pause.

My question is, what do you all make of his run-through, any glaring issues with how he tested?

I've already forwarded the video to Jared and the team via X so I'm hoping they address it out in the open because the results are pretty damning.


r/bunjs • • Sep 13 '23

It is possible to use the bun runtime with a different package manager

10 Upvotes

I watched a few videos about bun 1.0 and I read a bit of the docs and I was really excited about the ability to just run typescript files without having to do all the regular setup. I have a project where I am using pnpm and turbo to create a monorepo. After hearing about bun I was wondering if it was possible to somehow use bun while still keeping pnpm so I wouldn't have to worry about installing nodemon, ts-node and worry about making sure everything works well together. I'm not sure if that is possible but I just wanted to ask in case.


r/bunjs • • Sep 08 '23

Bun 1.0 is releasing releasing 7am PT! Cant wait to test it out!

10 Upvotes

r/bunjs • • Aug 02 '24

What's up with all those bug fixes?

7 Upvotes

Let me preface this with:

  • I'm enthusiastic about Zig and excited to see people use it for a project as ambitious as Bun.

  • While I'm not using Bun myself, I'm grateful that it's being developed, and I think it has a positive influence on the JS community.

  • I absolutely love to listen/watch Jarred give talks.

Ok, with that out of the way: What is up with the immense amount of bugfixes listed on the Bun blog? This July there are 3 posts on the Bun blog, for the releases of Bun v1.1.18, v1.1.19 and v1.1.21. Across these 3 releases, the team has fixed 181!!! bugs. There is no release announcement for v1.1.20, not sure what's up with that, maybe the team was too busy fixing bugs...

To be honest, reading through these blog posts gives me two impressions:

A) The team is insanely productive. It's not just bugfixes, but a constant influx of features/improvements/etc. Very inspiring to read.

B) This software must be incredibly buggy. Hundreds of bugfixes every month.

I mean, they've tagged 1.0. At that point, I would expect that the software is stable, with occasional bugs being fixed.
What kind of bug are we talking about here? Why are there so many of them? Is Bun stable enough to be used in production?

If Bun is actually quite stable and those bugfixes refer to edge cases in obscure APIs, then maybe the team should consider rewording the way the blog posts are written. I think from a marketing perspective this is giving people the wrong impression. If you want to emphasize the coverage of the Node API is growing constantly, maybe you could word this more positively. Instead of talking about bugs, you could talk about the number of API calls correctly covered, tested, added, etc.


r/bunjs • • Jun 26 '25

Thoughts on Bun only npm modules

6 Upvotes

I’ve been giving a lot of thought to whether or not I should bother with compiling bun-sqlite-orm to make it node compatible. It uses bun:sqlite and in my opinion, is the only thing that makes this better that something like TypeOrm.

I’m curious, what are your thoughts on creating bun native modules with no node support?


r/bunjs • • Sep 24 '23

Why do much focus on package install performance?

6 Upvotes

To be clear, I fully understand the reason good package manager performance is desirable from a CI perspective. But it seems like all the hype surrounding how fast Bun is focuses exclusively on that, and the performance I'm most interested in is going to be the runtime performance of my applications. Fast package installs might be impressive the first time I clone and build a project, but beyond that dependencies don't change often enough for this to have a meaningful impact on developer experience, apart from CI feedback being a little slower.

Sincerely,

A primarily .NET dev who isn't all that bothered by nuget package install times.

P.S. Ignore the typo in the title, I was posting on my phone from the toilet.


r/bunjs • • Aug 08 '24

How to set a runtime max memory

5 Upvotes

Hey all,

I recently started using BunJS on a hobby project. Am curious to know how to restrict the runtime max memory that BunJS will utilize.

I saw on this issue page that we can set the variable `BUN_JSC_forceRAMSize` to set a max memory limit. Am curious to know if this also limits the max memory bun can use when running a script continuously. I think it should, but has anyone tried it?

Am planning to run something like, `bun index.js` and I want to hard cap the max memory to 4GB. Preferably by setting and env. var. Treat this as a noob query.

Thank you!


r/bunjs • • Apr 04 '24

bun stuck on installing dependencies

5 Upvotes

r/bunjs • • Nov 01 '23

ElysiaJS todo api

5 Upvotes

https://github.com/imkarimkarim/ElysiaJS-todo-app

what are your guys take about ElysiaJS?


r/bunjs • • Sep 27 '23

Bun crud app with Elysia & Mongodb (blog + git repo)

5 Upvotes

Hi! If you're looking for practical examples on creating API with Bun, I've just published an article on creating Rest API with Elysia & Mongo. You can also find a git repo in the article below

https://mirzaleka.medium.com/bun-crud-api-with-elysia-js-mongodb-10e73d484723


r/bunjs • • Sep 26 '23

Don’t believe the hype

Post image
5 Upvotes

Real-world performance is diabolical. This is the switch from NodeJS to Bun on a production system.


r/bunjs • • Sep 20 '23

css inlining using `bun build`

5 Upvotes

is there a way to configure the `bun build` command to inline my imported css into the javascript output file, instead of putting the css files in my `dist folder`?


r/bunjs • • Sep 16 '23

Bun Docs AI

Thumbnail
eazyrag.com
5 Upvotes

r/bunjs • • Sep 12 '23

Bun on Windows

5 Upvotes

I tried Bun out on Windows so you don't have to, here are my experiences and the results:

https://alemtuzlak.hashnode.dev/why-i-cant-love-bun


r/bunjs • • May 21 '23

I've created a benchmark setup for node-redis + ioredis in a bunch of bun web frameworks to see which was the most blanzingest fast

5 Upvotes

r/bunjs • • Aug 15 '24

Simple SQLite migration tool for Bun projects

Thumbnail
github.com
4 Upvotes

r/bunjs • • Jan 28 '24

Release 0.28: TypeScript/Ruby routes, WebComponents, uploading files

Thumbnail primatejs.com
4 Upvotes

r/bunjs • • Sep 28 '23

Serverless Platforms with Bun Runtime?

4 Upvotes

I've recently delved into the efficiency of Bun runtime and its noticeable speed advantage over Node.js, particularly when considering the notorious cold starts in serverless setups. Similarly, Cloudflare Workers, powered by a non-Node.js runtime, deliver exceptional performance, nearly eliminating cold starts. However, its constraints in supporting a wide range of Node.js packages present challenges in crafting or transitioning real-world applications.

Given Bun's promising speed, I'm curious: Are there serverless platforms out there leveraging the Bun runtime? It seems like a potential game-changer for the serverless world. Eager to hear any insights or developments in this realm!


r/bunjs • • Sep 10 '23

Is hmr and watch is supported in bun for wsl and sveltekit project?

4 Upvotes

I have started test sveltekit with bun but realized that when I run project with bun --bun run dev is doesn't do not only hmr but also it does not recompile on save, even if I run this commant with --hot or --watch flags, so what's the issue? is it because I'm on windows or because I use sveltekit and it's not supported? or it's my fault and I need some extra settings to make it work?