dwyl / technology-stack

🚀 Detailed description + diagram of the Open Source Technology Stack we use for dwyl projects.
288 stars 26 forks source link

Bun? #139

Open nelsonic opened 3 months ago

nelsonic commented 3 months ago

https://bun.sh -> https://github.com/oven-sh/bun

image image image

Written in Zig ref: https://github.com/dwyl/learn-zig/issues/1

Note: We haven't seen a performance bottleneck in our Node projects recently. (mostly because we've not been using Node in a perf-critical project for a while ...) But the Bun appears to be faster at everything than Node. So I'm thinking of doing a SPIKE just to get it working on a basic project. 💭

I wonder if this is just just a case of "Faster Horses" ... Or if there is a benefit to this beyond speed?

ndrean commented 3 months ago

Check why Vite and Bun by Evan You (code splitting)

Screenshot 2024-07-15 at 15 32 35

Bun features Apple's Javascript runtime https://developer.apple.com/documentation/javascriptcore instead of V8.

nelsonic commented 3 months ago

Yeah, we've never needed to use code splitting. 🐌 It's a sign that the app is way too bloated. 😬 Our biggest ever front-end app was 147kb ... which I felt was silly (slow on mobile with slow 3G ... ⏳) But it's good to know that Bun is not targeting client-side apps. 👌

JavaScriptCore https://github.com/WebKit/WebKit/tree/main/Source/JavaScriptCore is written in C++. So is V8: https://nodejs.org/en/learn/getting-started/the-v8-javascript-engine#the-quest-for-performance ... There shouldn't be that much of a perf diff ... but all benchmarks say there is a huge diff between Node and Bun 🤷‍♂️ https://www.builder.io/blog/bun-vs-node-js

Again, not using this yet. Just opening the issue to capture thoughts. 💭

ndrean commented 3 months ago

A disgression, but for example, LiveView ships a lot (!) of (meaningful) Javascript. I believe the code should be split and stripped out from the unused JS. Vite or Rollup (or the new Rust RollDown should be used. But this is the work of the team, not ours. Take a look at Livebook, JS heavy. Plenty of React is injected. I don't understand why they didn't go the SolidJS for example, almost 10 times lighter and not virtual DOM. Probably read-to-use libraries, I didn't go into the details.

nelsonic commented 3 months ago

Yeah, Livebook is suuuuper JS-heavy; but it's unlikely to be used on a slow internet connection. 💭 Even the biggest JS Apps are smaller than the average <img> ... Not saying there's an excuse for bloated JS but there are apps that are complex and need a lot of code. Agree that some splitting could help lighten Livebook ... 💭 bun might not be the tool for that. 👍

ndrean commented 3 months ago

But... they did something amazing with Kino.JS.Live. I am not doing any kind of self promotion but take a closer look at the Livebooks I did (any correction/issue is welcome!):

I just though 👏👏