background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Bun (TypeScript) is faster than Rust!?!"

input logo icon
Video tags
|

Video tags

software
vim
programming
javascript
typescript
software engineering
web developing
web developer
software developer
developer
cpp
programmer humor
humor
reactjs
js
ecmascript
tc39
Netflix
Engineering
Engineer
Facebook
Amazon
Interviews
Software Interviews
vimrc
neovim
spacevim
vim c++
vim editor
text editor
vscode
vscode vim
vim plugins
autocomplete
vim autocomplete
nodejs
twitch
developer productivity
spacemacs
algorithms
datastructures
Data Structures
python
bash
coding
softwareengineering
vs
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:00
bun a blazingly fast all-in-one
00:00:03
javascript runtime with graphs and
00:00:05
science and everything this is supposed
00:00:07
to be the greatest thing that happened
00:00:08
to javascript in a long time and one of
00:00:11
the more cool parts about it is that it
00:00:13
does not use v8 it uses javascript core
00:00:16
and of course it's built using roth i
00:00:18
mean zig the greatest language ever
00:00:21
written ever yes i'm in my white hoodie
00:00:24
that means we're more on the front end
00:00:26
of things so therefore we are talking
00:00:28
about bun yes we're gonna also do node
00:00:31
and yes i snuck in a touch of rust and
00:00:35
we're gonna look at some performance
00:00:36
numbers i created an extremely simple
00:00:38
experiment just to try out buns see what
00:00:40
it's like and yes it in its simplicity
00:00:42
there's probably some air but i thought
00:00:44
it would be a really fun time to check
00:00:46
it out now bun of course is so new so
00:00:49
fresh off the presses it's less than a
00:00:51
week old for public consumption but the
00:00:54
promises the hype feels like we're gonna
00:00:56
have ourselves a blazingly fast time
00:00:59
blazingly fast oh gosh i even like kind
00:01:01
of scared myself saying that one i just
00:01:04
let the crackhead loose there for a
00:01:06
second before i show you the results i
00:01:08
should probably tell you what the
00:01:09
experiment was it's an extremely simple
00:01:11
experiment in which every single time
00:01:13
someone makes a request i would store
00:01:15
the json object that was made as part of
00:01:17
the request body into a queue a part of
00:01:20
the request path would be how long to
00:01:22
keep it in that queue and then i would
00:01:24
simply delete it i know it's kind of a
00:01:26
weird thing to do but why would i hold
00:01:28
on to an object for say 15 seconds well
00:01:30
here's the reason why is that i wanted
00:01:32
to be able to make sure that we're
00:01:33
really exercising out the garbage
00:01:35
collector i'm very curious to see what
00:01:38
is the performance of v8 versus jsc and
00:01:42
of course bun has very great integration
00:01:44
with a lot of those you know the system
00:01:46
calls and all that so hopefully we can
00:01:48
see some really big wins in the bun
00:01:49
department that just stomp no js so the
00:01:52
first thing i do is i try to empty the
00:01:54
queue we'll go over that in a second
00:01:55
next if this is a status call then i
00:01:57
just return the length of the queue next
00:01:58
i grab the time required to be in the
00:02:01
queue from the url parse out the body of
00:02:03
course create a nice body message which
00:02:05
has the expiry time which is now plus
00:02:08
the time in queue and the message itself
00:02:10
and then cue it you're probably saying
00:02:11
to yourself at this point
00:02:14
brian there's not a queue in in
00:02:15
javascript it's not even a part it's not
00:02:17
even a thing what are you doing you know
00:02:18
what i'm i'm so upset i'm gonna hit the
00:02:20
sub button and subscribe to your channel
00:02:22
to show you will you do that
00:02:24
right now and yes you are right i made
00:02:26
my own cue right here called it list
00:02:28
because that's uh that's what happens
00:02:30
when you program it in front of a lot of
00:02:31
people as fast as you possibly can you
00:02:33
just name things dumb but either way
00:02:34
it's just a simple queue that way i
00:02:36
don't have any of the penalization that
00:02:38
comes with using shift on an array in
00:02:40
javascript it's technically not even
00:02:42
really an array it's actually an array
00:02:44
list but that's neither here nor there
00:02:46
yes i use the exact same code inside of
00:02:48
the fastify version which is going to be
00:02:50
the node version and of course the empty
00:02:52
queue function is rather simple it just
00:02:54
simply gets the current time now and
00:02:56
just keeps attempting to look at the
00:02:57
queue until we finally are no longer in
00:03:00
the past and dequeuing all the way along
00:03:02
okay so this is a fairly simple
00:03:04
experiment but prime you say
00:03:06
what about the rust side of things well
00:03:08
i did the same things in rust okay
00:03:09
there's nothing i can really show you
00:03:10
that's very impressive other than i had
00:03:13
to use a mutex i couldn't not use the
00:03:16
mutex and it just emotionally damaged me
00:03:19
so i think i could have gone even more
00:03:20
blazingly faster if i would have not had
00:03:23
to use a mutex i tried to use the lock
00:03:25
free cue i just couldn't quite get it
00:03:27
because i need to be able to peek and
00:03:29
that just ruined everything so if you
00:03:31
think you're rustacious enough to drop
00:03:33
this lock then bank a pr baby oh but
00:03:36
prime where do we make a pr2 i'm happy
00:03:39
you asked again i let twitter name the
00:03:42
name and make me a logo and this is what
00:03:45
they came up with within one hour bun
00:03:47
spreader i'm so happy that this is now
00:03:50
on my github how am i supposed to ever
00:03:51
get hired again oh yeah i also use
00:03:53
actics so hey there you go use some
00:03:56
weight you know uh async await probably
00:03:58
could have squeezed out some more
00:04:00
performance out of rust but you know i
00:04:01
just gave this a first shot just right
00:04:03
at see what happens and it actually did
00:04:05
pretty dang well so let's go over the
00:04:08
results of this so i think it's very
00:04:10
important to talk about how i ran this
00:04:12
test now first i could have a test
00:04:14
client inside the lynode cloud and a
00:04:16
test server inside the lynode cloud i
00:04:18
could make 50 to 200 parallel requests
00:04:20
this was a tunable parameter to that
00:04:22
server instance then i could actually
00:04:24
have many clients making the same amount
00:04:27
of parallel requests which i did have
00:04:29
four of them finally after running for
00:04:31
over 15 seconds which is the time in the
00:04:33
queue we'd reach some sort of steady
00:04:35
state on the queue and so then i could
00:04:37
make small requests for the queue size
00:04:39
from my machine and monitor how big the
00:04:41
cue was by spreading out the requests
00:04:43
onto several clients it ensures that my
00:04:46
clients are operating at maximum
00:04:47
efficiency and my server is truly under
00:04:49
load the test consisted of having four
00:04:51
clients doing 50 parallel requests 100
00:04:53
parallel requests 200 and for rust and
00:04:55
note i went up to 300 i did not go to
00:04:57
300 on button i'll explain why in just
00:04:58
one second all right so here we go here
00:05:01
are the results the thing you've been
00:05:02
waiting for we have node and blue bun
00:05:05
and red and rust in apparently turd rust
00:05:08
color which is actually quite great that
00:05:10
that happened now the first thing you'll
00:05:12
notice is that rust crushed it even with
00:05:15
a mutex involved i really wish i could
00:05:18
have got rid of that mutex i just
00:05:20
couldn't like i said please go spread
00:05:22
some buns and spread me some mutex love
00:05:24
by removing the mutex even gamozo was
00:05:27
quite disappointed in my inability to
00:05:29
remove the mutex while offering
00:05:32
absolutely no advice on removing said
00:05:34
mutex which means i probably will need
00:05:36
ben's help or the other ben's help now
00:05:39
the first thing you'll probably notice
00:05:40
about this graph is that the blue line
00:05:43
kind of peaks around 100 concurrent
00:05:44
requests and then just goes downhill
00:05:47
sadly blazingly sadly well it turns out
00:05:50
node just became more and more under
00:05:53
load and just couldn't perform well
00:05:55
whereas rust just kept getting better
00:05:57
and better and better obviously the
00:05:59
returns were diminishing it was kind of
00:06:00
hitting its saturation point but still
00:06:02
looks really really good but the most
00:06:04
interesting thing you're probably
00:06:05
spotting is bun so right away you'll see
00:06:07
that bun is yes better than node but not
00:06:10
a lot better than node at least with
00:06:12
this individual test i just kept getting
00:06:14
segmentation faults any time i exceeded
00:06:17
a hundred concurrent requests from four
00:06:18
different machines i just kept having
00:06:20
this happen to me if you're not
00:06:22
segmentationing in javascript are you
00:06:24
really even trying the answer is no no
00:06:27
you're not but to be completely fair i
00:06:28
was able one of the times to get bun run
00:06:31
at about 150 or 200 uh concurrent
00:06:34
requests without seg faulting for a few
00:06:36
minutes and when that did happen my
00:06:38
requests per second were closer to the
00:06:40
hundred thousand so it did a much better
00:06:42
perform than node it just was having
00:06:45
problems being consistent with and of
00:06:47
course bun is still in a very beta kind
00:06:50
of you know experiment obviously a whole
00:06:52
new runtime only really just shouldered
00:06:55
and muscled by an individual so there's
00:06:57
plenty of time to bake it to make even
00:06:59
better performance wins to make even
00:07:02
more amazing things but as you can see
00:07:04
even if bun were to get dramatically
00:07:06
better and be able to sustain itself and
00:07:08
then even improve beyond what i saw by
00:07:11
another fifty percent sixty percent it
00:07:14
still isn't going to be able to beat a
00:07:16
real language i do want to be real here
00:07:19
for a second so why don't you give the
00:07:20
video a quick like and then i can do
00:07:22
that for you
00:07:23
the thing about it is that yes it is so
00:07:26
much easier writing javascript than rust
00:07:28
this is just a fact you know anyone with
00:07:30
some experience in javascript can get
00:07:32
something up and running faster it is
00:07:34
just a simpler language and i recognize
00:07:37
that but rust is really really really
00:07:40
fast and i really wish that the more
00:07:43
performance-constrained environments
00:07:45
people would stop recommending node as a
00:07:47
solution i think node is great for
00:07:49
exploration i think it's great for sites
00:07:51
that don't have a lot of traffic not
00:07:53
every single place is going to be some
00:07:55
sort of billion visits per day type of
00:07:57
location so it doesn't matter there so
00:07:59
it is about trade-offs and i am willing
00:08:01
to concede that i don't think it's
00:08:03
horrible using javascript for servers
00:08:06
when there's not a heavy need for
00:08:07
performance but i will argue that it's
00:08:10
extremely easy to simply write something
00:08:12
and go and you can kind of get that
00:08:14
pretty darn good performance of rust but
00:08:17
with more of the simplicity of
00:08:19
javascript now of course i didn't use go
00:08:21
in this comparison i think it'd be uh
00:08:23
just too much i had a lot of fun
00:08:24
learning and kind of reading about bun
00:08:26
and i think it has a really bright
00:08:28
future if you have the time go check it
00:08:30
out uh jared did a great job it's hard
00:08:33
to say anything bad about it fantastic
00:08:35
experience i think the only person
00:08:37
that's probably sad is dino the dinosaur
00:08:40
because well the dinosaurs going extinct
00:08:42
again people and of course all of this
00:08:44
was built live on twitch because that's
00:08:46
just what we do okay if i'm not
00:08:48
screaming and coding then what am i
00:08:50
doing with my life probably fathering
00:08:52
many wonderful children siring as some
00:08:55
would say thanks beautiful wife

Description:

I cannot believe this! Is bun ackshually faster? The best way to find out is to write some amazing tests. ### Repo https://github.com/ThePrimeagen/BunSpreader ### Twitch Everything is built live on twitch Twitch : https://www.twitch.tv/ThePrimeagen Discord: discord.gg/ThePrimeagen ### Editor All my videos are edited by Flip. Give him a follow! https://twitter.com/flipmediaprod He is also open to do more editing, so slide deeeeeeeeep into his dms. ### Links Linode: https://linode.com/prime https://discord.com/invite/ThePrimeagen Twitch: https://www.twitch.tv/ThePrimeagen Insta: https://www.facebook.com/unsupportedbrowser Twitter: https://twitter.com/ThePrimeagen VimRC & i3: https://github.com/ThePrimeagen/.dotfiles Keyboard (15% off, I don't earn commission): https://kinesis-ergo.com/keyboards/advantage2-keyboard/ chapters 0:00 Bun Is BlazinglyFast 1:06 The Code 4:08 The Methodology 4:57 The Results

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Bun (TypeScript) is faster than Rust!?!" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Bun (TypeScript) is faster than Rust!?!" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Bun (TypeScript) is faster than Rust!?!" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Bun (TypeScript) is faster than Rust!?!" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Bun (TypeScript) is faster than Rust!?!"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Bun (TypeScript) is faster than Rust!?!"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.