I hope you liked this video (literally, press the damn button already). If you like comparison videos / perf videos LET ME KNOW. TELL ME AND I'LL KEEP MAKING THINGS!!! Else I'll quit and make a vlog about my new protein drink line. ITS NOT A PYRAMID SCHEME... its a triangle.
@@ThePrimeagen I think you're my favourite programming channel now too. Only downside is you make me feel like dogshit when you roll out optimisation like this beast! 😁
just strted a bootcamp 3months ago and had some prev exp so i can understand maybe 15% of your content but nonetheless im learning a new little fragment of concept in every video that hopefully i will be able to master later..your energy is an inspiration...lets all screaaam moreeeee goddaaaaamn
Dude, that was a BLAZINGLY good video. I love how you add some humor to this technical content. By the way, the content was excellent by itself. It's good to know the tools you use to analyze the performance and how you optimized the code!
I just can’t believe how you manage this! Eng gig at Netflix, an ever increasing family size, what, is it now, 5 or 6 kids(?), live streams on twitch and then these buttery smooth, MCT oil’y goodness on the CZcamss! Keep up the great work!
had seen this video around 6 month's before, did'nt understand shit. It was recommended again in my feed today, and i tottally understand everytying. feel's so damn good!
Great video man. I really enjoy your content and always wait for a new video. Optimisations and comparisons are always interesting to watch. Keep up the good work.
The great thing about your videos is that the things you show can be applied anywhere with any language which is awesome. Also because you are ThePrimeagen I have to mention… I started using Neovim because of you. I wish I get as comfortable as you are someday.
Love the content! Your DSA course on Frontend Masters is one of the best contents I have ever watched. It really lives up to the expectation. Nothing has got me nearly excited about DSA as much as that course. Thank you very much. Love from Ghana! :)
Thumbs up 👍 I sadly missed this stream, caught the tail end of it as you were building the graphs. This content is amazingly blazingly fastacular. I got a little randy when you described the use case for the memory pool and then saw the improvements with it… best programming content on the web for people who actually have to build stuff.
Awesome content as always. There is a lot to learn from the way you approach optimization (I mean who doesn't want a bigger blue bar?), as without numbers you are just blind in the mist. Flame graphs are awesome!
I liked that I got to know how to improve performance of typescript programs. I would also like to know about a complete suite of tools, where database calls from typescript can also be viewed on a graph.
Great video. Loved how you told the story of the whole optimization process illustrated with your graphs. Showing us how to apply these tools along the way. And getting great results by applying some good fundamentals in algorithms and memory management. While I do like the overall tempo of the video, I find that getting too many shortly spaced cuts in your speech when you're explaining something more complicated can be a bit jarring and interfere with fully comprehending the content.
To make the example took ~30-40 hours of programming To collect that data took about 10 hours of different experiments To measure the health: github.com/ThePrimeagen/tyrone-biggums/blob/master/typescript/src/game_loop/game-callback.ts#L22 That collects the stats then whoever is the winner of the stats will send down how many currently active games were being played + the 8 points of data representing the count in each bin. Used a simple script to post process all the data transfered.
Such an interesting video, love the heavy use of data to prove your changes actually made a difference. Would love to see this kind of stuff compared with Rust and it’s non-garbage collected memory management.
Ahyo, just discovered this channel and I'm VERY interested in this optimization stuff, specifically for TS, but also with regards to the "how do you actually measure stuff". Explaining perf some more would be amazing. I cant really join twitch because of timezones, but if some of that made it to your yt-channel, I would be very happy!
This is great content! Currently my code is mostly slowed down by the slow rendering engine, so I was on a mission to simplify the HTML. Removing layers of containers (DIVs), replacing some with simple padding/margin. Probably going to look at object creation next.
@@ThePrimeagen Wathed the video again, Awesome. Thanks for introducing flame graph, node --inspect and how to use pool and ring buffer. And you got it, I'm pretty new :)
I’m really glad to see you comparing TS with Rust and Go. And in such a digestible format. Quick, understandable, and funny! I feel like the Rust and Go discussions ignore the fact that the majority of the job market for web is using JS/TS. And JS/TS developers ignore the hit to performance and server costs. Rust is incredible until you actually try to build something real. Go seems nice but falls short in it’s promise for simplicity, and has made some strange decisions. Great video!
I find go to be great. It gets better and better as you understand some of its decisions. I am fine with almost all of it Rust on the other hand. It is hard, but I am getting faster working through a lot of rusts weirdnesses as well. Each I can appreciate. At this point I am unsure if I am faster at JS or Rust for a lot of things.
Cool video dude. Yeah, JavaScript performance is strongly coupled to explicit memory management. As a general rule, avoid 'new' in hot code paths (allocate as much memory as you can up front and reuse). JavaScript also suffers from not being able to allocate structures on the stack (so all objects go on the heap + implicates the GC), in some extreme optimization cases, it may be nessasary to inline object properties to flat primitive values that do sit on the stack. There's an art form to making JS go fast, pity about the shit Web Socket libraries available for Node. You should performance benchmark Deno native Web Sockets vs Nodes ws library.
@@ebrelus7687 At this stage, the only way to keep JS lean is by writing code yourself and avoiding NPM dependencies (and then refining your code over years). Basically, you want to be writing directly against the core modules provided by the platform only (and only take dependencies if you absolutely have to) As for Bun, best to wait. However I'm skeptical that Bun will see significant performance increases over Node/Deno in practical use cases. The only thing Bun is doing that the other platforms are not (afaik) is implementing the sendfile API (which allows it to do zero copy of buffers and avoids kernel space to user space copies). Systems like Kafka use this API for performance, but it's fairly niche in terms of the places it can be applied. Id stick with Node/Deno for the foreseeable future.
Possibly explanation for why the memory optimizations made things faster: it may have actually made things slower overall - but the program is going to run with fewer or shorter interruptions by the garbage collector, which is probably why the blue bar goes up. 🙂
that is my general consensus. An "easy" to validate this theory would be to make this server run in the browser (i already have sockets sort of abstracted away as is) and build a simple socket impl to feed in fire commands. From this i will be able to use the performance tab in chrome debugger. I could export the data to json and sum up time spent in GC. Also, apparently in node i can pass v8 flags to the engine and get tracing for free, but I don't know how to do that :)
It was nice seeing development tools you use to analyze your code. I have never entered the memory tab before in dev tools and also cant seem to get the same view as you do. Did you do something else for that? I am using chrome. Thanks. Love your content.
yeah. You need to make sure you select the 3rd option, the bottom one, and record the heap sampler. Then you may need to select the view (i think it defaults to tree when it should be chart)
I hope you liked this video (literally, press the damn button already). If you like comparison videos / perf videos LET ME KNOW. TELL ME AND I'LL KEEP MAKING THINGS!!! Else I'll quit and make a vlog about my new protein drink line. ITS NOT A PYRAMID SCHEME... its a triangle.
Yes keep going
Love that contenttt , please do rust
I like it
Oh shit I forgot to add pooling to the database connection in my hobby project!
Performance videos are the best!
This is becoming one of my favourite programming CZcams channels... Blazingly fast!
Most excellent!
@@ThePrimeagen I think you're my favourite programming channel now too. Only downside is you make me feel like dogshit when you roll out optimisation like this beast! 😁
I really liked the graphs being included. Also i learned about flame graphs!
Yeah. FlameGraphs are SUPER useful.
Agreed, I’ll for sure be using flame graphs in the future
Amazingly good combo of tempo, humour and insightful knowledge. Been professionally developing for about 15 years. Loved this video big time!
Awesome! My goal is to make non slow tech videos :)
@@ThePrimeagen that feels like an untapped market on CZcams. Excited to see you pushing more of these out over time!
@@ThePrimeagen You could say your tech videos are... BLAZINGLY FAST
Oh Sheets, this guy is a data wizard
🧙♂
Prime is coming to steal jobs from data scientists LUL
@@adgai prime?
just strted a bootcamp 3months ago and had some prev exp so i can understand maybe 15% of your content but nonetheless im learning a new little fragment of concept in every video that hopefully i will be able to master later..your energy is an inspiration...lets all screaaam moreeeee goddaaaaamn
YAYAYAYAYAYA! Keep your chin up, you got this babe!
Dude, that was a BLAZINGLY good video.
I love how you add some humor to this technical content.
By the way, the content was excellent by itself. It's good to know the tools you use to analyze the performance and how you optimized the code!
The Primeagen: Bringing the science back to computer science since 1969
czcams.com/video/cbCu9sUzcXg/video.html
This blew my mind. Time to start monitoring the performance of my node server
awesome! I thought the memory stuff was really surprising for me.
Entertaining, fun and full of new techniques to learn! *_BLAZINGLY FAST_* channel!!!!
need this TYRONE content streamed directly into my brain
get ws, a blazingly fast library.
clicked the vid blazingly fast
And like the vid blazingly fast
Karen!!
watched the vid blazingly fast at 2x the speed of normie watchers who watch at 1x!!!!
It has become rare, that YT videos really make me lol, but man, you definitely still got the power to make me giggle. Top notch blazingly fast sub!
There's more science in this video than 90% of the academic papers that I had to read in my academic career, congrats man :)
Big ups for sharing/exposing us viewers to this visualization tool for identifying performance bottlenecks….so clutch!
I’m in love with this channel, it’s amazing. Wish there were even more videos.
Trying! Its hard to make good videos :)
Rewatching this after SOLIDjs dev hour is even more satisfying. Thanks for reminding
I just can’t believe how you manage this! Eng gig at Netflix, an ever increasing family size, what, is it now, 5 or 6 kids(?), live streams on twitch and then these buttery smooth, MCT oil’y goodness on the CZcamss! Keep up the great work!
It's the mcts baebee
@@ThePrimeagen hmmmm....it's always the MCTs!!!!
Can’t wait for the Rust vs go comparison
same! Almost done with the go server.
I love optimization videos and it's really cool to see your process and tools to solve a slow implementation problem. Keep them videos coming!
had seen this video around 6 month's before, did'nt understand shit. It was recommended again in my feed today, and i tottally understand everytying. feel's so damn good!
Boy oh boi! that was Blazingly FAST!
🏃♂️⚡️⚡️
thank you marcos :) See you on twitch.
Love the video! The mix of informative and funny is well balanced and I learned something out of it.
awesome! Did memory part surprise you?
Great video man. I really enjoy your content and always wait for a new video. Optimisations and comparisons are always interesting to watch. Keep up the good work.
awesome! Hopefully you feel like you had a couple of action items to take away if you ever work in node.
The great thing about your videos is that the things you show can be applied anywhere with any language which is awesome.
Also because you are ThePrimeagen I have to mention… I started using Neovim because of you. I wish I get as comfortable as you are someday.
Wow! Not gonna lie the memory pool stuff felt over my head a bit but hey, this is good stuff Prime. More comparison/perf stuff plz.
JSJOEIO!!! What??!!! Memory pools are the bestest!
@@ThePrimeagen lol guess i've never had a reason to use em'??? but with those performance gains, might be worth learning
I like the eloquence of your videos, I appreciate you, you give me inspiration to make better code Blazingly fast!
BLAZINGLY FAST!
Thank you for the nice words.
Love the content! Your DSA course on Frontend Masters is one of the best contents I have ever watched. It really lives up to the expectation. Nothing has got me nearly excited about DSA as much as that course. Thank you very much. Love from Ghana! :)
Thumbs up 👍
I sadly missed this stream, caught the tail end of it as you were building the graphs. This content is amazingly blazingly fastacular. I got a little randy when you described the use case for the memory pool and then saw the improvements with it… best programming content on the web for people who actually have to build stuff.
Hah! Now it's a bit dangerous doing pools. They are hard to use properly
@@ThePrimeagen But what if it's a pool of coconut oil?
The amount of effort put in optimizing this youtube content is over 9000
This was refreshing, the information been shared in this channel is on point!
Yayayayaya! Ty. Just trying to cut through the yt bs
This is such a great video! Got introduced to this channel at work!
great! I am happy you like this.
Awesome content as always.
There is a lot to learn from the way you approach optimization (I mean who doesn't want a bigger blue bar?), as without numbers you are just blind in the mist.
Flame graphs are awesome!
yayaya! Always start with a proper yard stick.
Would love to see similar benchmarks and profiling in Go 🙏
I am going to try to do some great go content.
That is next. Next will be a rust vs go.
LOVE THIS! Awesome video, I loved how you went over the ring buffer, always nice to see some cs theory in the mix
I LOVE seeing these perf videos, just subbed :D
Keep them coming!
We LOVE tthese blazingly fast videos ♥️
Awesome. I hope you enjoyed this.
Great content! Somehow I really like JS things, and these kind of content is awesome. This is becoming my fav tech channel
thanks for covering the flame graph stuff. that was really interesting to learn about
Great video prime! Keep it up, love the graphs
good. I do too :)
man that was really informative video
♥♥♥
you are welcome :)
I would like to invite Prime to make a lecture for my students... problem - we use VSC 😬😅❤🤗 still - I love Primeagen 🎅
hahah! that is ok. Students have to start somewhere.
Vscode is the only way, vim is for pure savages
I liked that I got to know how to improve performance of typescript programs. I would also like to know about a complete suite of tools, where database calls from typescript can also be viewed on a graph.
Yeah, more is awesome. A lot of these tools you speak of are pay to play
Great video. Loved how you told the story of the whole optimization process illustrated with your graphs. Showing us how to apply these tools along the way. And getting great results by applying some good fundamentals in algorithms and memory management.
While I do like the overall tempo of the video, I find that getting too many shortly spaced cuts in your speech when you're explaining something more complicated can be a bit jarring and interfere with fully comprehending the content.
Solid feedback. I'll consider that moving forward.
@@ThePrimeagen I think this is a personal preference. I like the cuts, makes it more compact and keep my attention.
Unbeatable content, congrats!
How long did it take you to get this done? How did you measure the avg health of your loops and generated those charts?
To make the example took ~30-40 hours of programming
To collect that data took about 10 hours of different experiments
To measure the health: github.com/ThePrimeagen/tyrone-biggums/blob/master/typescript/src/game_loop/game-callback.ts#L22
That collects the stats then whoever is the winner of the stats will send down how many currently active games were being played + the 8 points of data representing the count in each bin. Used a simple script to post process all the data transfered.
This is gold content. I love it!
I Usually do not comment, but I wanted to help you satisfy your graphs fetish.
ty ty ty! Its very fetishy too
12 minutes? That is not blazingly fast at all
Just finished the video, and it was really interesting! Great job
I do love you, don't mind my twitter presence... he is a jerk.
Love seeing those graphs 😍😍😍
really like the case study, really easy to follow. I would really like to see some C++ experiment from you, maybe in comparison with Rust?
I'll be doing go vs rust. c++ is just soooooo much effort. I'll spend like 15 hours just getting the proper build system
@@ThePrimeagen Yeah, I completely understand the problem with C++ for these "side-experiments". Go vs Rust sounds awesome!
A 1 sec improvement in js in comparison to itself is really a blazingly fast improvement 😂
it really is!!! hah
woo just learnt about flame graphs, really cool!
Just a comment to increase the comment amount graph. Your content is golden!
Ya ya, ty
I would be interested in more in-depth js optimization videos, nice job!
I WANT MORE OF THE PRIMEAGEN!!!!!
I AM TRYING
Does the primagen edit his own videos? Cause the editing is sharp and hilarious
I’m the editor:) Thank you I appreciate that!
@@flipmedia1597 Right on! The editing is hilarious! Great stuff 🙏
@@flipmedia1597 The editing is next level. It's as tight as hand-written assembler code.
Super insightful. Heading on to twitch now. Also, I hope this comment helps you plot those sweet perf improvement graphs.
Ty, and they do
me likes it, me likes it a lot. Please do a Go and Rust comparisons!!! Now putting myself into await pool for that
yayayayayayaya! Just don't forget to bring your Tokio Mutex if you are awaiting into the pool.
never seen flamegraphs but they seem to be a nice thing! thanks for showing those to us
I've never turned a notification bell on before =O
I like your style. Great content. Thanks for putting it out on here and keep it up 🙏
Just letting you know: I like this content
THank you :)
I would really like to see some more in-detail optimization tutorials about tools and how to use them for JavaScript/TypeScript. 😊
This is now my fav programming channel
Also everything for some reason became blazingly fast
Even my anxiety
Help
this happens to us all
I liked this video very much and I learned a lot. Keep up the good work! ❤💪
Thank you
Amazing content as always! I would like to see this comparisons vs unoptimized Go server
yeah. That is literally next.
how did you solve that so.... BLAZINGLY FAST xD
But srsly, really good content, cant wait for the Rust VS Go video
Yyayayayayayaytaa
Such an interesting video, love the heavy use of data to prove your changes actually made a difference. Would love to see this kind of stuff compared with Rust and it’s non-garbage collected memory management.
Absolutely loved this video. Thank you.
You are welcome
looking forward to the RxJS part
we will see :)
Ahyo, just discovered this channel and I'm VERY interested in this optimization stuff, specifically for TS, but also with regards to the "how do you actually measure stuff". Explaining perf some more would be amazing. I cant really join twitch because of timezones, but if some of that made it to your yt-channel, I would be very happy!
Awesome!!!!, I really enjoy watching this!!!!!
Good job!
I personally would like to see a similar comparison with Go.
its already on its way.
Wow!! That's blazing fast 😮
Such Fast
Much wow
The guy who screams in the video is literally my definition of pro. Wanna be like that guy one day.
I do like screaming
This is great content!
Currently my code is mostly slowed down by the slow rendering engine, so I was on a mission to simplify the HTML. Removing layers of containers (DIVs), replacing some with simple padding/margin.
Probably going to look at object creation next.
I saw those flame graphs when profiling my app, but didnt really know how to read em 😂 Happy i do now
this is awesome! I hope to quit writing CSS and start writing flame graphs one day.
One day, in the not so distant future?
GIVE RUST AND GO GRAPHS!! Also would love you join your protein drink line triangle.
Excellent! You will get paid based on how much you sell and how many more triangles you can get under you.
It would be great to delve deeper into flame graphs 🔥
!!! You never know! I want to play around with the go performance tooling.
@@ThePrimeagen i would highly recommend that if you have some time to spare!!
nice video prime!! Love to see this in rust.
That red line at 11:09 was smoother than my linear Thocky Switches ❤
kreygasm!
Wanting this series to keep going…
Just got done collecting the date for part 3!!!
@@ThePrimeagen
This is amazing stuff I can watch this all day
Multi-threaded JS, native add ons, data driven eng initiatives. These 👌
This video does not make any sense to me, but I like it and I will watch it again.
Why not? Are you new or am I bad at explaining?
@@ThePrimeagen Wathed the video again, Awesome. Thanks for introducing flame graph, node --inspect and how to use pool and ring buffer. And you got it, I'm pretty new :)
I like perf videos, especially comparison.
I’m really glad to see you comparing TS with Rust and Go. And in such a digestible format. Quick, understandable, and funny!
I feel like the Rust and Go discussions ignore the fact that the majority of the job market for web is using JS/TS. And JS/TS developers ignore the hit to performance and server costs. Rust is incredible until you actually try to build something real. Go seems nice but falls short in it’s promise for simplicity, and has made some strange decisions.
Great video!
I find go to be great. It gets better and better as you understand some of its decisions. I am fine with almost all of it
Rust on the other hand. It is hard, but I am getting faster working through a lot of rusts weirdnesses as well. Each I can appreciate.
At this point I am unsure if I am faster at JS or Rust for a lot of things.
Cool video dude. Yeah, JavaScript performance is strongly coupled to explicit memory management. As a general rule, avoid 'new' in hot code paths (allocate as much memory as you can up front and reuse). JavaScript
also suffers from not being able to allocate structures on the stack (so all objects go on the heap + implicates the GC), in some extreme optimization cases, it may be nessasary to inline object properties to flat primitive values that do sit on the stack. There's an art form to making JS go fast, pity about the shit Web Socket libraries available for Node. You should performance benchmark Deno native Web Sockets vs Nodes ws library.
How about bun? Where could I read about keeping js stack leaner? Thanks for the tips you gave.
@@ebrelus7687 At this stage, the only way to keep JS lean is by writing code yourself and avoiding NPM dependencies (and then refining your code over years). Basically, you want to be writing directly against the core modules provided by the platform only (and only take dependencies if you absolutely have to)
As for Bun, best to wait. However I'm skeptical that Bun will see significant performance increases over Node/Deno in practical use cases. The only thing Bun is doing that the other platforms are not (afaik) is implementing the sendfile API (which allows it to do zero copy of buffers and avoids kernel space to user space copies). Systems like Kafka use this API for performance, but it's fairly niche in terms of the places it can be applied.
Id stick with Node/Deno for the foreseeable future.
Yes we love this content, we love to learn how to make our apps go brrrrrrr
awesome! Hopefully that sweet little data structure I threw in the mix was great :)
Great videos man
I am amazed. Incredible content!
you are welcome!
I am glad you liked it.
Possibly explanation for why the memory optimizations made things faster: it may have actually made things slower overall - but the program is going to run with fewer or shorter interruptions by the garbage collector, which is probably why the blue bar goes up. 🙂
that is my general consensus. An "easy" to validate this theory would be to make this server run in the browser (i already have sockets sort of abstracted away as is) and build a simple socket impl to feed in fire commands. From this i will be able to use the performance tab in chrome debugger. I could export the data to json and sum up time spent in GC.
Also, apparently in node i can pass v8 flags to the engine and get tracing for free, but I don't know how to do that :)
Reusing bullets... Sounds even more violent.
Such violence, much wow.
I like these kind of videos. Please make them more.
This is great 😍
Awesome. Thank you grim
I really like your js content
It was nice seeing development tools you use to analyze your code. I have never entered the memory tab before in dev tools and also cant seem to get the same view as you do. Did you do something else for that? I am using chrome. Thanks. Love your content.
yeah. You need to make sure you select the 3rd option, the bottom one, and record the heap sampler. Then you may need to select the view (i think it defaults to tree when it should be chart)
Loved it.
Awesome! I am happy here :)
great content as always, if you can suggest a resource to learn more about optimization that would be Blazingly Helpful !
This is cool!
I agree!
I love this kind of content
More of this please.