Bun (TypeScript) is faster than Rust!?!
HTML-код
- Опубликовано: 4 июн 2024
- I cannot believe this! Is bun ackshually faster? The best way to find out is to write some amazing tests.
Repo
github.com/ThePrimeagen/BunSp...
Twitch
Everything is built live on twitch
Twitch : bit.ly/3xhFO3E
Discord: discord.gg/ThePrimeagen
Editor
All my videos are edited by Flip. Give him a follow! / flipmediaprod He is also open to do more editing, so slide deeeeeeeeep into his dms.
Links
Linode: linode.com/prime
/ discord
Twitch: / theprimeagen
Insta: / theprimeagen
Twitter: / theprimeagen
VimRC & i3: github.com/ThePrimeagen/.dotf...
Keyboard (15% off, I don't earn commission): bit.ly/primeagen-adv2
#coding #programming #softwareengineering #javascript #vs
chapters
0:00 Bun Is BlazinglyFast
1:06 The Code
4:08 The Methodology
4:57 The Results - Наука
Would you like me to do add in Zig + Go?
Yes
Yes
haters gonna hate blazingly fast
Please add Go !!
Yes :chad:
Zig isn't memory safe like Rust is, which I'd guess is why you're getting blazingly fast segfaults.
whats the point of zig over c++ or c then ?
God tier comment.
take off every zig
You're absolutely right, as I also seg faulted myself several times on stream
daaayum
Man... as a computer science researcher, I love your experiments! Thanks for bringing this "scientist" spirit to the public! :)
yayaya! I actually try to follow a more rigorous style.
1. test
2. consistent methodology
3. results
People tend to just mix 1 + 2 and not consider the implications of that (say local host testing).
You had my hopes up for a blazingly fast second there
The old switcheroo eh?
@@ThePrimeagen Can you do a video on WASI and NodeJs?
This was really informative. Can't wait for the Go and Zig comparisons as well. Thanks Prime 👍
It would be extremely interesting to rebuild your TS server that you used to compare against GO and Rust in Bun. I think everyone would love to know what percentage of requests would be within acceptable ms using Bun instead of Node
yeah! It actually wouldn't be very hard at all because its the entry point that was different, the rest is plain ol js.
@@ThePrimeagen see is there any reason to ever build rust servers if go servers are just that good in every case except the most extreme teams? Since go is usually faster and rust code needs to be really good to beat it doesn't it just make since to write go code for most code bases?
@@KManAbout there is a reason, discord was using go backend in the past and switched to rust
@@echoptic775 sure, but 99% of us aren't Discord or at FANG scale
@@poolkrooni more like 99.99% of us almost none of use are ever going to have billions of users.
Before: is nodejs faster than rust?? (lol no)
Now: is bun faster than rust??? (lol no, with segmentation faults)
No one can survive on RUclips without clickbait. lmao
other thing with bun is, it is open to unhealthy amount of puns which will make our lifes kind of unbearable at some point
these are facts. which is why i tried to make 0
@@ThePrimeagen 6:58 "plenty of time to bake it" 😏
Writing this server app will be fun on a bun :D
Bender from Futurama has no objection :P
How is this the first time I come across this channel! This was amazing, subbed!
tyty!
A revisit once bun has matured some more could be interesting. Great content as always.
yeah, i figured i would do a zig + go + bun test here in 2 weeks.
yes we need this
Bun 1.0 is out now
On Theo's video had huge doubts about the claims that bun http is faster than rust. Glad to see an unbiased comparison that lives in reality
people constantly run bad experiments.
please be careful when looking at results :) Always expect a methodology.
To be fair I’m not smart enough to write the Rust code for testing comparisons
Got inspired to try vim with your vids. I'm tempted to try rust now
Read the book. I know prime doesn't recommend it but it's really good.
Read “A Half Hour To Learn Rust”
Nice to start the work week with upbeat prime energy
yayaya!
I’ve been waiting for this! 😁
Golang is also very strict. A thread locking a mutex twice is doomed to be a dead lock. Unlocking a not locked mutex is a Go panic. Both are programming errors. I try to implement something like async/await for QML and Go, stop at a QML-Dialog in your code and wait for the result before proceeding. You can still have callbacks/signals, but for dialogs it is much more convenient to hold your program (thread) until there is a result.
I have been immediately reminded of you when I saw the BLAZINGLY FAST phrase from bun lol
I can't express enough how I like Prime performance. Dude you are the best!
I was waiting for this review. Blazingly fast!!!
there is going to be a follow up :)
Another great video. The end got me really good. Shout out to Mrs. Primeagen! 😂
ty friend
7:16 “A real language” loool
I only speak the truth
your channel deserves more views all around
I love these "BlazinglyFast" series so much! :D
they are most excellent
I tried many new C/C++ like languages and zig is subjectively the most fun to use, the most readable and do-not-get-in-your-way language. Also it comes with toolchain that makes it really easy to work with C/C++ libraries and mix code.
yeah! it is really fun, though i have never tried to debug/other tool it.
try Odin
your videos are BLAZINGLY BEAUTIFUL.
This comment is Blazingly Appreciated
bun has a very bright future behind her
Dang, cold as ice
@@ThePrimeagen you're the one who spread the bun and show us the light.
remove MUTEX with the Backspace button
The John carmack of our time
I'll love to see this test again with Bun 1.0
Zig is basically C, but the shotgun is a boomerang. Jokes aside, after looking at how well Zig integrates with C, assembly and adds neat features to C, I'm sure it will have a certain niche as a C replacement for hardcore nerds. The nerds who love cool, weird and at the same time incomplete languages like Vala or Julia, for example.
i mean julia is pretty complete yk
Good that you didn't mention Matlab
Hi! Waiting forward for a comparison now that Bun 1.0 is out. Thanks for your insights!
+1
+1
Really wanted to see that `aboo` method show up after `peek` dropped and got me all excited
How this guy can code at this level and entertain at the same time? It is a completely different talent tree and yet he managed to do that.
and here i was excited about blazing fast bun, see you my friend it was nice knowing you
hah, i am going to get cancelled, arn't i?
Could you compare the performance of Kotlin and Golang? Kotlin has coroutines which are very similar to goroutines, it simply multiplexes jobs to threads. But it offers structural concurrency which is the greatest thing I've seen lately.
real language master race
I'd like to see more frontend Primeagen in the future, please.
Lets settle! Thanks for the vid bud :)
I love go. I started learning it because of your videos. Would love to see a go comparison
go is up next
Most of our batch servers / micro services at my company are Spring boot and I’ve suggested multiple times that we can consider Go as a way for front end devs familiar with Typescript to relatively easily make contributions to servers but the overwhelming pushback is - Node and Java are easy to hire people for.
i hate that argument. i think go is really getting easier to hire for every day. Plus there is a TON of devs who don't want to keep getting javascripted
Is your TS queue a lock-free concurrent queue or does it work because it is single threaded anyways? Is peeking really necessary or could it be avoided, peeking seems kind of impossible in a lock free context to me as a dequeue could happen in an ABA scenario?
This was fantastic! also, usually I put the playback speed to 2x for most people. Max I can do is 1.5x for you and still understand. lol
i am a winner!
prime is blazingly fast
Blazingly sad is a pretty apt description for all my projects
Node is a great beginner language that's for sure. It can perform relatively well enough by scaling up more instances but will be pricier over big load. ❤️ for Golang for an easy learning curve and being much more BLAZINGLY FAST.
Agreed. Go Lang is definitely the best choice for the balance of developer, velocity and speed
Go for the win 🥰
Node is not a language.
@@johanw2267 You're right! But JS by itself can't do much outside of the browser 🙃
@@johanw2267 Your input is pointless here sir. Keep it to yourself.
Love you Prime ❤
ty
I was waiting for this video and I was sure that you gonna add that "Blazingly fast" even though they didn't put it
That logo made me bust out chuckling so loud i think i scared my neighbors 😅
Hi, nice video.
Could you do a part 2, adding Python, GoLang, and Zig to this graph comparison?
I think it would be nice to see, just out of curiosity.
Lol... I love the concession "Node is fine for the backend if your site sucks and get's no traffic and you don't care if it performs well."
I would like to see Deno included in these benchmark. it's blazingly Great to use Deno.
Do you have recorded live steam where you do these kind of tests?
Not saying that i doubt your test results, but I'm curious what is your process of making these test, like i wanna see the full coding, how you collect data and stuff like that.
If I say I stream one more time on twitch I swear.
@@ThePrimeagen lol sry
:soyjak: Noo, no GO comparison. How am I suppose to claim superiority online now as GO developer.
I'll be possibly doing that!
@@ThePrimeagen Great, I've never been happier!
Hey, nice video, for the Rust side Can you try yo open a thread for managing the vecquedeque and sending message through channels to see how it compares to the mutex?
I like how you said "Real Language"
You're hilarious! Thanks for sharing!
Edit skills Tier 3
Completely agree. Flip is getting too powerful
Blazingly recived SIGSEV ( core dumped )
Blazingly Segfaulted
"the dinosaur is going extent again people !" had me.
Okay now Bun reached stable. Do it again!
DEW IT!
Awesome! Still waiting the ELIXIR version of that other server
You PROMISED. gotta keep your promises hehe
Good insight
Be interesting to see how much of the js/rust difference is due to the difference in queue implementations; VecDeque uses a ring buffer which will avoid memory allocation and garbage collection entirely once it reaches steady state, whereas your JS implementations use linked lists with dynamic allocation for all enqueues, which will dramatically increase GC pressure.
I'll redo it doing a ring buffer, and in zig because I can
nice colortheme ! What is your colortheme ?
I subbed only because of this dudes presentation style. LOL.
Does twitch save livestream for later viewing? It is hard to catch livestreams when I live on opposite side of date line.
yes!
@@ThePrimeagen daddy i watch you later
"voice and energy for a political video" + "accessible semi-deep dive content for a technical video" + "editing for a social video" = awesome stuff!
Thanks for the video. Just a comment on speed for bigger websites...
For bigger websites it is very likely that there are multiple replicas the API endpoints. Like with Kubernetes (but not necessarily) and a load balancer on top. So if performance is a problem...
1. You can scale vertically with a bigger machine
2. You can indeed use a faster technology (rust,...)
3. You can scale horizontally and increase the number of replicas
It doesn't mean that you should not use Rust, it's just that if you hit bottleneck with Node or other technologies there are other options.
this is true. but horizontal scaling as a solution is coming to an end. Its already started to get squeezed in certain geographic regions and I do not see a slow down.
Vertical scaling will become the new norm and node is very tricky with state to vertically scale. Also you get a ton less for your buck on vertically scaling.
This feels the like the DENO Hype-train all over again
My favorite thing about this video is prob all the times you say..."Que"...I'll wait for it.....🤣😂!
Good stuff as usual ! The fact that I have to literally take notes when I watch your videos should say something...So...Go, Rust, and now Bun (Typescript)..Bruh im just getting my feet wet with React....and its no even mentioned. 😩.
~Cheers!
Is that elixir comparison still coming 👀
Betteridge's law in action
Very informative. Please make this video with bun 1.0
What do you think of .net core do you think it is a worthy to compete?
One way around mutex could be channels. By publishing the data to a VecDeque on another thread, you may not need a lock on it as you'd have passed the ownership to the data to that thread? And run the dequeue part on this thread as well ?
That’s a blazingly fast bun spreader lol.
what I liked the most about bun is that you can write typescript and JSX and just RUN IT!!!!!!!! without any pre configuration files being all over the place! It feels like this is what javascript or node should have been like since the beginning.
Yeah, that part is incredible
There is `tsup` package for node, which uses esbuild. Not sure about JSX, I use `tsup` for ad-hoc CLI scripting
"if I'm not screaming while coding, then what I'm doing with my life"
Prime, is there a reason why you release videos on Monday mornings (US time)? I think you would get more traffic in the afternoon or other times... I don't have much knowledge in the SEO/YT algorithm area so it might be completely wrong, but I'm still curious...
negative.
there are reasons, and if you have my stats you would know too :)
@@ThePrimeagen Gotcha 👍
we need a jon_gjengset_pilot plugin for the next rust implementation
Is it really JS faster at prototyping? how long did it take to write + debug JS and rust?
what font do you use in the terminal?
Bun fails to tell you about these benchmarks... bun is cache'ing EVERYTHING.
5:47 ".. blazingly sadly .." 😂
prime is the DR disrespect of the dev world :D
Segfault in JavaScript hahahaha XD A dream come true
Can we make sure the tests are not utilizing multi-CPUs?
I saw a test comparing Golang with Nodejs but when they reduced the CPUs of golang down to 1, go and nodejs were not very different.
zig zags into segfault
On Rust u made workers for each CPU, did u do the same in the node/bun?
1 worker on 1 cpu
I only test on single cpu instances.
F I R S T ?
Blazingly first
mmm mm mmh. I'm seeing big wins in the bun department. Yesir.
Can we get an updated reaction for bun 1.0? :)
Best project name
Man i love when u scream: blazingly faaaast ❤️❤️❤️ best content as usual! Im becomong addicted to u and theo.gg ❤️❤️❤️
:)
You said "bake" about bun.
Nice.
you are welcome
Did you used Tokyo 🗼? Or just vanilla Rust?
what about Deno? does Bun beat it on this benchmark?
I’m frontend dev and I love how other roasts JavaScript and its entire ecosystem as well as the framework-mania. I think we worked hard enough and we fully deserved it 😂.
I’m discovering Rust currently and make the same with Go last year to get a picture of both. One thing I don’t yet get is a web development (client) using one of these languages. At the first sight it looks to be too complex and bloated. For running an API server I wanted Go to replace my Node instance immediately 😅.
I'm not offended by Rust jokes. It's great to make memes because people use too much "blazingly fast". Subscribed :D Have a nice day!
I think he would be an actor, something like "my name is Earl"
Can you build it in C#?
Bun 1.0 just released, would like to see a rematch
Watching this at 1.5x made my blood pressure spike.