I did a fun experiment to expose the cost of GC
### Links
V8 https://v8.dev/blog/high-performance-cpp-gc
Code: https://github.com/ThePrimeagen/yt/blob/master/is-javascript-slow/test.js
### Twitch
Everything is built live on twitch
Twitch : https://bit.ly/3xhFO3E
Discord: discord.gg/ThePrimeagen
Spotify DevHour: https://open.spotify.com/show/4MLaDrQcQ5mi3rsnvWkwPt
### 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.
Join this channel to get access to perks:
https://www.youtube.com/channel/UC8ENHE5xdFSwx71u3fDH5Xw/join
### Links
Linode: https://linode.com/prime
https://discord.gg/ThePrimeagen
Twitch: https://twitch.tv/ThePrimeagen
Insta: https://instagram.com/ThePrimeagen
Twitter: https://twitter.com/ThePrimeagen
VimRC & i3: https://github.com/ThePrimeagen/.dotfiles
Keyboard 15% off https://bit.ly/Prime360 USE CODE PRIME360
#vim #programming #softwareengineering
don't really get what's going on… but I LIKE IT! Please teach me more daddy
Which is blazingly fast, C# (.NET 6 or 7) or Go? I'm asking for Bill.
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!
This is the best content I have seen by you, do more like this!
I don't think people are going to listen to the last part of this video. You only need to be concerned about this if you profile your application and you're seeing that you're having an issue. In the real world you likely won't be creating millions of objects and then deleting them and if you are then there's likely a much bigger problem in your codebase than object spreading. When I code, I code for developer productivity. If there is an issue with performance that's when you pull out the profiler and see what you can do to increase performance. "Premature optimization is the root of all evil" – Donald Knuth
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
Tech papa brings JS truths. 👍
I’ve heard that reference counting is a good strategy for UI’s. Would this mean that front end apps could get better performance with Rust and Wasm using ref counting (as wasm catches up with V8)?
Really amazing video !!!!
Moreeee deep diveeeeee
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
I love this!
This is the data based advanced stuff that no one else on YouTube really does. With realworld fang experience to back it too!
You keep apologizing for being weird with your jokes, bro, it's why we're here!
TO much subscribe subscribe !
Yay on the technical vids/amount of code. Made happy brain chemicals
Love the more technical deep dives
definitely a fan of these JS deep dives.
What about memory consumption in the second scenario? 🧐
Show More code.
just when I started to get confident in JS, this guy comes in and basically smashed it to the ground….again 😀
first time in my life googled what is garbage collection except what is vim
The idea of an object pool in a library like fastly sounds like (if I understand correctly) it would be incredibly easy to misuse, because the user needs to be very careful when to release the request object. On the one hand, if you release it too early/hold onto the object for too long and (for example) use it across an await point, the JS engine may well execute another request and it could reuse the released object (and effectively write request data of the new request to the object which is still in use by the other request). Then once it goes back to executing the old request, it has all the request data from the new request. On the other hand if you forget to release the object, it "leaks".This sounds almost like manual memory management but in JS
fu and your functional 🤣
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!
I really enjoyed this video and yes I would like to see more content where you do a code review just like this. Youtube 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.
Yeah, more technical videos please. Thanks!
double clicked on Like button 🤣
AMAZING🔥
re-watching…
Okay you crossed a line, I'm unsubbing for 69 seconds
how do you point so accurately?
Oh Prime these technical JS deep dives are fire 🔥🔥🔥
What a shit show. The fix is the ugliest thing I’ve ever seen. If the garbage collector had any sense of professional pride it would gobble the whole language and set itself on fire.
I super like it
quite good amount of code, it did really well, nice explanations
not… blazingly fast, BUT it is HOW to become blazingly fast!
Java and JavaScript both need object pooling for performance. Coincidence?
liked, subscribed, and pressed the bell. Great video
Can you make this for Go and Java as comparison?
U didnt say blazing fast:'( whatever, check just JS runtime please, its BLAZINGLY FAST
I liked the video only because you send me to read the description and the way you requested was funny 😂
Technical videos are as cool as crazy twitch chat bashing ones. But I benefit from the technical more.
2:20 all the Haskell programmers left
me like it