How I Made JavaScript BLAZINGLY FAST

  Рет қаралды 208,717

ThePrimeagen

ThePrimeagen

Жыл бұрын

I did a fun experiment to expose the cost of GC
Links
V8 v8.dev/blog/high-performance-...
Code: github.com/ThePrimeagen/yt/bl...
Twitch
Everything is built live on twitch
Twitch : bit.ly/3xhFO3E
Discord: discord.gg/ThePrimeagen
Spotify DevHour: open.spotify.com/show/4MLaDrQ...
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.
Join this channel to get access to perks:
/ @theprimeagen
Links
Linode: linode.com/prime
/ discord
Twitch: / theprimeagen
Insta: / theprimeagen
Twitter: / theprimeagen
VimRC & i3: github.com/ThePrimeagen/.dotf...
Keyboard 15% off bit.ly/Prime360 USE CODE PRIME360
#vim #programming #softwareengineering

Пікірлер: 447
@blirdo
@blirdo Жыл бұрын
I'm pretty sure that Prime is talking about my code when he says garbage collection.
@paulheisner
@paulheisner Жыл бұрын
Holy sh**, i had to laugh out loud reading this
@ayoub.k
@ayoub.k Жыл бұрын
Your comment wins.
@asedtf
@asedtf Жыл бұрын
My collection of garbage is certainly slow. This statement is true in every possible interpretation
@ThePrimeagen
@ThePrimeagen Жыл бұрын
its beautiful but its garbage
@blirdo
@blirdo Жыл бұрын
@@ThePrimeagen I thought it was what's on the inner scope that counts :(
@artifishul
@artifishul Жыл бұрын
Big fan of the more technical stuff like this
@stasgavrylov
@stasgavrylov Жыл бұрын
Man, you should definitely make more of those deep-dives, you have so much knowledge to share. If you could also drop a link to this code in the description, that'd be really useful. Thanks for the great tip!
@ThePrimeagen
@ThePrimeagen Жыл бұрын
i will! for you, here you go github.com/ThePrimeagen/yt/blob/master/is-javascript-slow/test.js
@stasgavrylov
@stasgavrylov Жыл бұрын
@@ThePrimeagen 👈😎👈
@Draxen
@Draxen Жыл бұрын
Agreed, straight 🔥
@HuxleysShaggyDog
@HuxleysShaggyDog 10 ай бұрын
Based
@Psy45Kai
@Psy45Kai Жыл бұрын
Love auch JS deep dives. I am myself a C++ and now (partially because of you) Rust developer and like this performance stuff 😁 Since I just start using JS I like listening to JS ninjas like you are. This is much more interesting than most low level JS stuff on YT 😁 Thanks for your high octane videos ✌️
@benjaminughegbe4255
@benjaminughegbe4255 Жыл бұрын
hey, please what's JS ninja? did he mention it in this video? ask cos I may not watch till the end 😬
@jesusgonzalez5709
@jesusgonzalez5709 Жыл бұрын
100% agree
@ThePrimeagen
@ThePrimeagen Жыл бұрын
just trying to have a bit of fun out here
@pchick
@pchick Жыл бұрын
@@benjaminughegbe4255 it just means proficient with js
@benjaminughegbe4255
@benjaminughegbe4255 Жыл бұрын
@@pchick oh, thanks a lot
@cal3461
@cal3461 Жыл бұрын
Awesome timing. Just learned about how Rust manages memory today so this will be a nice contrast!
@jordanasghar6419
@jordanasghar6419 Жыл бұрын
My favorite type of videos from you! I use JS all the time and see the spread pattern constantly, never thought to consider the GC impact under the hood but makes total sense!
@alexandersemionov5790
@alexandersemionov5790 Жыл бұрын
I love it. Object pool is quite a popular technique in game engines to reuse npcs and so on. Please continue with this format
@Zzznmop
@Zzznmop Жыл бұрын
It’s crazy that I’ve watched your channel on twitch and KZbin for years and learn something new every time I listen Thank you!
@scottiedoesno
@scottiedoesno Жыл бұрын
Really enjoy the technical stuff! As someone who has more than a casual relationship with JS, these kind of engaging technical analyses are super useful on a very regular basis
@82TheKnocKY
@82TheKnocKY Жыл бұрын
I love this! This is the data based advanced stuff that no one else on KZbin really does. With realworld fang experience to back it too!
@aaronroethe1010
@aaronroethe1010 Жыл бұрын
love all your videos, keep up the technical side and I love your Go content!
@typeer
@typeer Жыл бұрын
Man I'm so grateful for you communicating this stuff in 10 min chunks so good ty sir
@filipecrosk
@filipecrosk Жыл бұрын
Mna, these kind of content is all I need!! Thanks for sharing. Performance, performance, performance!!! Learn how to dig inside the runner and understand what parts of your code is taking longer and then debug to get it better is what everyone should learn. I know it's advanced for a lot of people, but learn how to debug is an art that we all should give more attention to. Again, I'm 1000% for more content like this!!!
@lisyr4918
@lisyr4918 Жыл бұрын
I am a junior dev, but even understanding only about 50% / 60% I am learning so much watching your videos, thanks for this incredible quality videos!
@SiisKolkytEuroo
@SiisKolkytEuroo Жыл бұрын
Is there something specific you did not understand about the video, I'd be happy to explain
@odorlessflavorless
@odorlessflavorless 8 ай бұрын
@@SiisKolkytEuroo I did not even the problem statement here. Is it about tweaking the code in a way the V8 engine does not run garbage collector ?
@SiisKolkytEuroo
@SiisKolkytEuroo 8 ай бұрын
@@odorlessflavorless yeah I suppose you could say that. Or, writing your code in a way that doesn't do as many allocations and doesn't leave much garbage behind
@vin1208
@vin1208 7 ай бұрын
@@SiisKolkytEuroo bro tbh i did not understand the first function, the closure i do not understand it, never used it in real life in what case scenario would that function be used so from that i barely understood the whole video, i dont even know class components and what was he trying to do with all that props1 props2 props3 and the vocalbulary he used i didnt understand most of it, im self taught so i only understand code but not terminology.
@daveisradicle
@daveisradicle Жыл бұрын
Great video, super smart way of showing off GC operations and how to work around them.
@blackfrog1534
@blackfrog1534 Жыл бұрын
YES Primeee back at it with the technical stuff. For me this is your best type of content and the streams that lead up to it are so much fun!
@ThePrimeagen
@ThePrimeagen Жыл бұрын
yaya! I do love the technical content and i think its super fun.
@krombopuloslincler4849
@krombopuloslincler4849 Жыл бұрын
Please do these type of videos more. Love it
@jamesfoley4426
@jamesfoley4426 Жыл бұрын
I really enjoyed this video and yes I would like to see more content where you do a code review just like this. KZbin is filled with junior developer content. It is hard as an intermediate to find content that improves your skill set/skill level. I think with your knowledge base your technical review of code is extremely beneficial.
@zuzuz18
@zuzuz18 Жыл бұрын
Super high quality video. One of your best yet
@velho6298
@velho6298 Жыл бұрын
Great stuff! Interesting to listen these more technical topics.
@klegsy
@klegsy Жыл бұрын
These are the primeagen videos I enjoy the most! Keep them coming
@fyndor
@fyndor Жыл бұрын
Hey Mr./Ms. video editor, loved the "Not sure what he wanted me to do here lol" :D I always forget most of the good content creators have an editor making these guys much better than they would be on their own. You are doing a good job btw, whoever you are.
@thecoincritic
@thecoincritic Жыл бұрын
Thanks for the content. I've been working on how to rework blockchains without so much promise dependency...love these thought experiments. Best...hope the Volcano experiment works out!
@MrBaudin
@MrBaudin Жыл бұрын
It was a great video, i would like to see more content like this. My opinion on the vid was that the setup could be shorter, the explanation of the code a bit longer and the ending was perfect! Performance is a difficult topic and these videos really help explain your thought process, please make more of them.
@Rihsto
@Rihsto Жыл бұрын
Oh Prime these technical JS deep dives are fire 🔥🔥🔥
@ds_7
@ds_7 Жыл бұрын
I loved this, I love your technical videos, MOAR CODE!!!
@dulanjala
@dulanjala Жыл бұрын
this is exactly the kind of content needed, deep dive into certain things...
@chrisjames278
@chrisjames278 Жыл бұрын
Love these walk throughs. Great to have more
@calcs001
@calcs001 Жыл бұрын
Love this deep dive.. keep it technical, go deeeeeep sir, deeep!
@chrishamilton1728
@chrishamilton1728 Жыл бұрын
I'd love to see a conversation between you and the React devs about the "Immutable" philosophy. So many new objects, every single render, it hurts...
@ThePrimeagen
@ThePrimeagen Жыл бұрын
probably could squeeze quite a bit out on the server if they stopped
@chrishamilton1728
@chrishamilton1728 Жыл бұрын
​@@ThePrimeagen React's whole change detection system is built around shallow diffing two objects sooooo..... But it's not a design flaw, because it makes your code *_PURE_* 😇🙏 pure garbage
@marcusrehn6915
@marcusrehn6915 Жыл бұрын
​@@chrishamilton1728 Immutability is a sound concept that is. There are a number of ways to implement it in a far more performant manner. Sadly, javascript arrays and objects have pretty much none of the characteristics needed. There are libraries like Immutable JS, but that also falls short because no library is going to pass us an immutable list, for example after a database query. So you would have to make at least one copy of the array when converting to Immutable. How about we just skip JS on the server, at least where performance matters?
@pm1783
@pm1783 Жыл бұрын
@@marcusrehn6915 agreed
@danielchettiar5670
@danielchettiar5670 Жыл бұрын
@@chrishamilton1728 Imo vdom is unnecessary with modern hardware. If they took that out, react dx would be much better and they also wouldn't have to do the diffing. But that's a monumental change that's never gonna happen. Good that we have other great open source ui libs
@spitefol5504
@spitefol5504 Жыл бұрын
This is the best content I have seen by you, do more like this!
@codewithguillaume
@codewithguillaume Жыл бұрын
Dude I love this video. Got to watch it again.
@tannishkmankar3998
@tannishkmankar3998 Жыл бұрын
IT WORKED, THANKS I'VE BEEN LOOKING FOR THIS FOREVER, BUT NO TUTORIAL COULD EXPLAIN IT AS YOU DID
@benjaminkindle1841
@benjaminkindle1841 Жыл бұрын
The amount of energy this guy can summon while talking about such dry topics is truly impressive
@leptanian
@leptanian Жыл бұрын
Personally I like the more technical videos you make. These walkthroughs and explanations are extremely valuable imo. And as always the editing is top-notch, Flip is the man.
@fluffykeebz
@fluffykeebz Жыл бұрын
2:34 -- first time I have been unable to resist the call to hit subscribe. I have subscribed, Daddy Primeagen.
@poochy661
@poochy661 Жыл бұрын
I really like these break-down videos where you show us what not to do and what to do if we want to go BLAZINGLY fast!
@conradbuck2414
@conradbuck2414 Жыл бұрын
I wrote a streaming regex engine and it hammers the GC pretty hard because it needs to create an object for each state it passes through, and on any real text and expression it passes through a lot. I studied its perf because I thought I'd have to pool the state objects, but instead profiling showed that I was only spending ~20% of my time doing GCs. That's because v8's generational garbage collector is optimized for the collection of objects that are small, short-lived, and have a common structure/shape. Engineers should not shy away from using those kinds of objects!
@abneryang2102
@abneryang2102 Жыл бұрын
More of this plz. CI jest runs have been killing us and this was cool to watch with that in mind
@skiesaboveunlimitedstargaz7316
@skiesaboveunlimitedstargaz7316 Жыл бұрын
Awesome & Greatness!! Very Excellent point!! That's why I sometimes, do not use Promises especially if it takes a lot of time.. But it all depends on the data how you use them and put them onto the objects.
@aburner230
@aburner230 Жыл бұрын
+1 more deep dives, this is the first video of yours I watched, and it was great
@ffshawon1287
@ffshawon1287 Жыл бұрын
It really worked for me after I look and try some tutorials, yours is the one that worked. Owe you a lot.
@ThePrimeagen
@ThePrimeagen Жыл бұрын
LETS GO!!
@_Aarius_
@_Aarius_ Жыл бұрын
Lots of the time people are writing code that's more IO bound than CPU bound, but it's still useful to know these tricks for the areas where you are in a hot CPU loop
@m.minkov
@m.minkov Жыл бұрын
I have pressed all the buttons! I love these videos, I am incredibly interested in internals and how performance can be increased. Please dish out more!
@TheKiller9696
@TheKiller9696 Жыл бұрын
Really enjoyed this content! Would love more videos like this
@TheKiller9696
@TheKiller9696 Жыл бұрын
@ThePrimeagen good job, you are big enough to have bots
@mikebruce6790
@mikebruce6790 Жыл бұрын
Awesome video, thanks for making this 🙏
@th34lch3m1st
@th34lch3m1st Жыл бұрын
I like it. Really inspiring concepts. Keep it up.
@wlidWisdom
@wlidWisdom Жыл бұрын
i love these king of videos .. keep going !
@AlphaWatt
@AlphaWatt Жыл бұрын
Love this stuff Prime
@markclynch
@markclynch Жыл бұрын
Love the more technical deep dives
@dickheadrecs
@dickheadrecs Жыл бұрын
i’m here for this, the hot takes are just gravy
@c__beck
@c__beck Жыл бұрын
I'd love to see one of these showing the Promise issue you mentioned!
@null_bite
@null_bite Жыл бұрын
Love thiss .. keep em coming!! 😍
@writegoodcode
@writegoodcode Жыл бұрын
dude love this, please make more technical content like this.
@ThePrimeagen
@ThePrimeagen Жыл бұрын
I thought it was fun
@writegoodcode
@writegoodcode Жыл бұрын
@@ThePrimeagen yup it definitely was
@writegoodcode
@writegoodcode Жыл бұрын
@@ThePrimeagen learnt so much, like sucking mics, etc
@joaomachado9105
@joaomachado9105 Жыл бұрын
your amazing but that editor does wonders too, props to that dude/lady whoever he/she is xD
@CraigClayton-bk3ze
@CraigClayton-bk3ze Жыл бұрын
As a newbie to programming I didn't not have a clue what the Primeagen was talking about, but I still really enjoyed it.
@GovindKumar-pe4lz
@GovindKumar-pe4lz Жыл бұрын
Thank you for explaining this thoroughly!
@petrpechkurov3095
@petrpechkurov3095 Жыл бұрын
Thank you, Mr. ThePrimeagen!
@ethSiberianDex
@ethSiberianDex Жыл бұрын
I love these science adjacent videos, they are like reading scientific articles but more fun
@alejonanez
@alejonanez Жыл бұрын
Man, this channel is the best 🎉
@jogofin4939
@jogofin4939 Жыл бұрын
I'd like to see a more in-depth breakdown of how garbage collection works as pertains to promises, and how you circumvented promises altogether. Good stuff
@nikensss
@nikensss Жыл бұрын
I also like the technical stuff, feels really nice to understand better what's going on with the tools you are using. Would it also be possible to share a repo with this code?
@erikslorenz
@erikslorenz Жыл бұрын
This is great thanks. I usually don't worry too much about it since if I'm using JavaScript it's not in a performance = money scenario
@willl0014
@willl0014 Жыл бұрын
I didn't understand half of it, but this was a pretty interesting video. I think i will look into this more. Thank you for sharing
@ErmandDurro
@ErmandDurro Жыл бұрын
Really great content. Love it 😀
@changuchito69
@changuchito69 Жыл бұрын
love this type of videos!
@RafaLeyvaRuiz
@RafaLeyvaRuiz Жыл бұрын
I liked the video only because you send me to read the description and the way you requested was funny 😂
@harrybilsonia
@harrybilsonia Жыл бұрын
Prime!! Sending you some algorithmic clues to show more code
@dontpanicyou
@dontpanicyou Жыл бұрын
definitely a fan of these JS deep dives.
@marcolerena456
@marcolerena456 Жыл бұрын
Hey Prime, I checked out your course on Frontend Masters, but I don't wana pay for their monthly membership just for your courses - I'd rather just buy courses from you. Also, I would really love a comprehensive backend course (in Js(ts) and/or rust) from you. You're one of the most entertaining and technically competent programmers on youtube. I'd love to learn from you!
@DIEZ919191
@DIEZ919191 Жыл бұрын
DAMN! Finally I found someone who teach like a savage! Usually I find myself sleeping right after couple of minutes of *explaining* something, here in a turn, I want to break my fckn retina display like rock star breaks his guitar! BTW didn't understand how you implemented test example, but it doesn't matter!
@ThePrimeagen
@ThePrimeagen Жыл бұрын
hah, well, i do like teaching at break neck speed
@alexcasillas
@alexcasillas Жыл бұрын
Great video!! Though I’m extremely curious about the refactor of the promises and that performance gain, can you elaborate more on it apart from GC taking so much time? I’d love a video about this :) Great job, love your channel 🔝
@ThePrimeagen
@ThePrimeagen Жыл бұрын
I'll do a video on it.
@Kurimson
@Kurimson Жыл бұрын
Yea, me too. Definitely Left me wanting more 😊.
@kiernanacuesta1417
@kiernanacuesta1417 Жыл бұрын
This is great, thank you!
@earthling_parth
@earthling_parth Жыл бұрын
I LOVE it! Please more technical stuff! PRIME, I AM SENDING YOU THE ALGORITHMIC SIGNALS PRIMMEEEEE!!!!
@ThePrimeagen
@ThePrimeagen Жыл бұрын
Let's go!!
@codingdude8782
@codingdude8782 9 ай бұрын
Do more, I love this video
@bryanchulander
@bryanchulander Жыл бұрын
So informative. Thank you
@yumyum7196
@yumyum7196 Жыл бұрын
Please!!!! More technical videos like this one 🙏🙏🙏
@mekhoinfo2118
@mekhoinfo2118 Жыл бұрын
the deepest video about JS I've ever watched lol, now I know that I have a long road before me to become like you @ThePrimegen
@nitheeshraajar393
@nitheeshraajar393 9 ай бұрын
How/Where do you start learning all this stuff???? So much in-depth knowledge and its really fascinating. Makes me wanna go indepth too
@user-pz9qh9rj8z
@user-pz9qh9rj8z Жыл бұрын
thanks a lot!!! so nice reverb
@LeandroCoutinho
@LeandroCoutinho Жыл бұрын
Amazing stuff! For more profiling like that!!!
@michaelross3061
@michaelross3061 Жыл бұрын
Yay on the technical vids/amount of code. Made happy brain chemicals
@lopoyadriang.9114
@lopoyadriang.9114 Жыл бұрын
Thank you, it works perfect!
@gustavcoetzee5018
@gustavcoetzee5018 Жыл бұрын
Love this content. Learn good stuff
@ahmadkhudai
@ahmadkhudai Жыл бұрын
liked, subscribed, and pressed the bell. Great video
@thanhn2001
@thanhn2001 Жыл бұрын
More please. I like this kind of stuff.
@tarotv4609
@tarotv4609 Жыл бұрын
Thank you for this! Super cool video! A+++
@StuartLoria
@StuartLoria 9 ай бұрын
I liked this video, I would like to see the one where he replaces promises
@wforbes87
@wforbes87 Жыл бұрын
actual technical content about a language that no one really thinks about technically is the true performance optimization involved here
@amirhoseinfarhadi2268
@amirhoseinfarhadi2268 2 ай бұрын
We love this type of videos 😍😍
@ayca198
@ayca198 Жыл бұрын
That was great. Thank you.
@venkateshhariharan4341
@venkateshhariharan4341 Жыл бұрын
These kind of videos are educational thanks
@koern82
@koern82 Жыл бұрын
Plz do more JS stuff. Thanks for this great video!
@JRasmusBm
@JRasmusBm Жыл бұрын
Favorite vid so far 😃
@fandimn2628
@fandimn2628 Жыл бұрын
Still working as of today! Thank you!
@TayTayChan
@TayTayChan Жыл бұрын
Yeah, tech-heavy videos are great. Code is life
@giacomogagliano1526
@giacomogagliano1526 Жыл бұрын
you are way too funny =) and also smart!! great job!!
@g3l0y
@g3l0y Жыл бұрын
Faster prime, I need this in my project
@darkveil07
@darkveil07 Жыл бұрын
hanks lot Sir.. You helping us..
@bryanchulander
@bryanchulander Жыл бұрын
Keep making these
Is JSON Blazingly Fast or...?
9:57
ThePrimeagen
Рет қаралды 183 М.
This Algorithm is 1,606,240% FASTER
13:31
ThePrimeagen
Рет қаралды 700 М.
Uma Ki Super Power To Dekho 😂
00:15
Uma Bai
Рет қаралды 41 МЛН
Зомби Апокалипсис  часть 1 🤯#shorts
00:29
INNA SERG
Рет қаралды 6 МЛН
ПЕЙ МОЛОКО КАК ФОКУСНИК
00:37
Masomka
Рет қаралды 6 МЛН
New AI Video Tool from Google - Veo! SORA Killer?
6:14
Nadim Explains
Рет қаралды 27
How to make TypeScript Blazingly Fast (JavaScript/NodeJS)
12:49
ThePrimeagen
Рет қаралды 111 М.
Performance of JavaScript Garbage Collection | Prime Reacts
26:46
ThePrimeTime
Рет қаралды 68 М.
Programming on TikTok
6:08
ThePrimeagen
Рет қаралды 303 М.
The ultimate guide to web performance
6:43
Beyond Fireship
Рет қаралды 391 М.
How Slow Is JavaScript? | Prime Reacts
15:34
ThePrimeTime
Рет қаралды 165 М.
My Best Decision Professionally
5:40
ThePrimeagen
Рет қаралды 138 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,5 МЛН
Any Sound & Call Recording Option Amazing Keypad Mobile 📱
0:48
Tech Official
Рет қаралды 325 М.
APPLE УБИЛА ЕГО - iMac 27 5K
19:34
ЗЕ МАККЕРС
Рет қаралды 92 М.
What % of charge do you have on phone?🔋
0:11
Diana Belitskay
Рет қаралды 312 М.
С Какой Высоты Разобьётся NOKIA3310 ?!😳
0:43