Only The Best Developers Understand How This Works

  Рет қаралды 113,534

Web Dev Simplified

Web Dev Simplified

Күн бұрын

Пікірлер: 119
@oscarleon3008
@oscarleon3008 5 ай бұрын
I started watching your videos in 2020 as a way to learn. I told myself I'd self-teach myself enough to eventually land a junior job... 4 years later I still learn something new every time I watch one of your videos. And yes, I'm happily employed as a software engineer now :)
@dj10schannel
@dj10schannel 5 ай бұрын
Grats
@WebDevSimplified
@WebDevSimplified 5 ай бұрын
Congratulations on the job! It's a lifetime of learning. I still learn new things every week it seems like.
@abh1yan
@abh1yan 5 ай бұрын
​@@WebDevSimplifiedhave you ever tried reading the Ecmascript standards?
@PrincipalDev
@PrincipalDev 4 ай бұрын
Garbage collection doesn’t happen immediately because it is thread blocking, so the browser may postpone it until an idle frame or until too much memory is used to avoid FPS drops. This is why you absolutely have to manually garbage collect (little icon showing a broom or brush) before testing. Otherwise your tests may be unreliable (as seen in this video when Kyle has to hard refresh). To check for memory leaks: 1. Manually garbage collect 2. Take snapshot 3. Perform the action that allocates memory (add some todos for example) 4. Perform the action that de-allocates memory (remove all todos) 5. Manually garbage collect 6. Take snapshot 7. Memory allocated between snapshots 1 and 2 should be close to 0. Better yet, repeat steps 2-6 and check the difference. If the difference increases you have a memory leak.
@nitsanbh
@nitsanbh 5 ай бұрын
5:09 "Any time you use a string, a number, a boolean - those [primitive values] will stay in memory forever, because they are not being garbage collected." Very inaccurate. Let's explain. Not all primitives are the same: some are stored in the heap, and some are in-place. Small integers (up to 31 bits) and booleans are in-place. They don't need clean-up (they'll be freed when the thing that holds them is freed). Larger integers (and floating point numbers) ARE stored in the heap. They are held by a pointer and they do need clean-up. All strings are stored in the heap! and hence, they WILL BE cleaned up, unlike what Kyle says. The reason that "innerString" wasn't cleaned is because V8 employs an optimization strategy called "Interning". Since people use strings pretty-much like enums, V8 keeps small strings in memory for longer, to avoid re-allocating them later.
@marketfinds
@marketfinds 5 ай бұрын
I was going to ask if you are worried about memory then using classes more would result in better cleanup but doesn't sound like the case. Good video otherwise.
@gurusystem
@gurusystem 5 ай бұрын
The other reason the "innerString" was retained in memory is because it is console logged, so the engine has to keep it in memory in case the DevTool needs to inspect it.
@jj-big-slay-yo
@jj-big-slay-yo 4 ай бұрын
This interning is the exat same as in java. THe nameing and the way of working is the same. So something more that makes javascript similar to java :)
@kavinda.jayakody
@kavinda.jayakody 4 ай бұрын
@@gurusystem Yep. Console logs are pure evil when it comes to memory allocation. Had couple of bad memory bloats due to logs
@NashBrooklyn
@NashBrooklyn 4 ай бұрын
a fun fact - the word null (and its other variations zero, hero, xero, rexo, orex, rex, xer) comes from arabic word for a hole in the ground which used to imprison debtors (those who never paid their debt to the king) - ergo the word - hole - you see during the garbage collection - is basically putting garbage into the hole - or nullifying as arabs in the middle ages would say - PS: and yes they did not have a numeric value which would represent a zero - so they used a letter for it - and guess what was the letter? that was the letter O as in owe - the letter resembles rounded edges of the debtor's hole in the ground -
@NavySturmGewehr
@NavySturmGewehr 5 ай бұрын
Would you be willing to do a bit of a deep dive into IndexedDB? I really want to figure out how to use it for state in a react application.
@Frostbytedigital
@Frostbytedigital 5 ай бұрын
Dexie makes it pretty simple. They have some react specific hooks aswell but I use it in every framework for browser saved state that can take any ... even files!
@denverjamesduran2750
@denverjamesduran2750 5 ай бұрын
Hey man you should definitely look up for tinybase. It offers reactivity and supports indexedDB too
@NavySturmGewehr
@NavySturmGewehr 5 ай бұрын
@@Frostbytedigital Yeah, there is a fair amount of data I want to store that would do best in a database style method of storage!
@lsavio5165
@lsavio5165 5 ай бұрын
Try SQL lite
@gkiokan
@gkiokan 5 ай бұрын
Interesting. Keep up the good work. I am doing Enterprise Development for 11 Years now and never had to use this. Following best practices and writing clean code helps for sure. But once you might need to debug your Memory and Performance, this is quite a good Guide as to where to start from. Good Job man.
@harleyspeedthrust4013
@harleyspeedthrust4013 5 ай бұрын
some of the comments are a little mean. the title is accurate; only the best developers know how memory works in v8 (and in general). you don't become a great developer by hopping javascript frameworks every week.
@someoneunknown8222
@someoneunknown8222 4 ай бұрын
Wow, I thought javascript developers don't know that the information requires some memory to be stored in. Glad to see that at least best ones know such a thing.
@ashwinsuryawanshi
@ashwinsuryawanshi 4 ай бұрын
People who don't understand a language would often criticise it.
@someoneunknown8222
@someoneunknown8222 4 ай бұрын
@@ashwinsuryawanshi people who don't understand programming would often choose javascript
@ashwinsuryawanshi
@ashwinsuryawanshi 4 ай бұрын
​@@someoneunknown8222 People who don't like programming would often start with HTML, CSS and end up learning JavaScript as that's what will land them a job. That is why most of the programmers working on JavaScript don't understand it well.
@ashwinsuryawanshi
@ashwinsuryawanshi 4 ай бұрын
@@someoneunknown8222 Thank you for making me laugh 🤣
@lakhveerchahal
@lakhveerchahal 5 ай бұрын
This one was very informational! Great work Kyle!
@neelthakkar4492
@neelthakkar4492 5 ай бұрын
Great insight about how to debug memory leak. Thanks for the information.
@shooting4star2023
@shooting4star2023 5 ай бұрын
A bit of misinformation in the video. Values of primitive/scalar types are also subject to garbage collection, not just reference types.
@TimK
@TimK 4 ай бұрын
Great video & explanation on garbage collection in Js!
@paradox3210
@paradox3210 5 ай бұрын
You can expose the GC and then trigger it with the little broom icon. That way, your snapshots are always "clean". I am currently struggling with a memory leak with Nuxt SSR - a small example like yours is easy, but as soon as you have a whole enterprise app, it gets really difficult to isolate things 😑
@0ninetyseven97
@0ninetyseven97 4 ай бұрын
i am learning more and more from your videos. this helps me alot as a beginner! thanks so much kyle!
@aeronwolfe7072
@aeronwolfe7072 5 ай бұрын
good info Kyle. I learn something new from you all the time!!!! I appreciate you man!!!!!!!!!!!!
@kirillvoloshin2065
@kirillvoloshin2065 4 ай бұрын
by the way, hovering over the grey text starting with @ will show more info. also clicking on a record on a heap shows retainers of this object
@abu2musa
@abu2musa 5 ай бұрын
The debugging video and this one are like goldmines for developers. I always wondered why the performance part and debugging in chrome browser is not thought as it makes life so much easier.
@Frexuz
@Frexuz 5 ай бұрын
Maybe hint in the title Wtf the video is about?
@srdjagunjic
@srdjagunjic 5 ай бұрын
Nah, the title is clickbait for the first few days and then he changes it to something normal. Algo playing...
@irahazda
@irahazda 5 ай бұрын
@@srdjagunjic Veritasium had a video explaining this
@aeronwolfe7072
@aeronwolfe7072 5 ай бұрын
quit b**ching
@GNXClone
@GNXClone 5 ай бұрын
Because it leaves you wondering "How WHAT works?" That said, Kyle's videos are gold and worth clicking. He doesn't need to bait us, imo.
@timoBike
@timoBike 5 ай бұрын
Really appreciate this video. Is possible to have another video to talk about how to find memory leak efficiently in Node JS service ?
@OudinAlex
@OudinAlex 5 ай бұрын
Not really what I would call a memory leak, but we get the concept. Nice video
@dimitargetsov9690
@dimitargetsov9690 5 күн бұрын
First of all, I give my full respect to You. I would like to hear how You understand "memory leak". Might some new idea will come out of it .
@yarin0600
@yarin0600 4 ай бұрын
08:00 - Golden tip!
@SperkSan
@SperkSan 5 ай бұрын
I have been using JavaScript for about 4 years and never knew there was a WeakMap class
@migy220
@migy220 5 ай бұрын
For example, in react. can we view the data stored in memory under the Memory?
@hut_fire1490
@hut_fire1490 5 ай бұрын
Thanks Kyle ! Its very informative
@todd.mitchell
@todd.mitchell 5 ай бұрын
Perfect timing! Thanks for this.
@ChrissyCode
@ChrissyCode 5 ай бұрын
WeakMap i only use, when for example i want to figure out if data is duplicated or already added or not. But i could also just use a normal map, and clear it after the function. Or the map also get's cleared if initialized inside of the same scope
@r.ebenezerpaul6850
@r.ebenezerpaul6850 4 ай бұрын
heyy!! great video... My question is how do you know this?? like where do u get ur info from?
@Gigawattt
@Gigawattt 5 ай бұрын
In Chrome, is there a difference between opening an “incognito” window and just opening a Guest profile window? Both seem to give you no extensions, a clean history, and empty cache?
@Laura69
@Laura69 27 күн бұрын
I would say guest window is better since you can't use extensions there at all, but in incognito is possible to enable extensions explicitly.
@RandomGeometryDashStuff
@RandomGeometryDashStuff 5 ай бұрын
05:10 what about strings that don't exist in source code but created dynamically like `Date()`?
@yatinarora1252
@yatinarora1252 5 ай бұрын
see date exists on window object,so i will be staying in memory but date that we created will be holding in a variable that will be cleared by garbage collector.
@doppeltevier
@doppeltevier 5 ай бұрын
Could you create a video about Atlassian's new framework-agnostic, low-level dnd library called "pragmatic-drag-and-drop"?
@dweblinveltz5035
@dweblinveltz5035 5 ай бұрын
Isn't it a bit misleading to say that "primitives stay in memory forever?" True, they aren't stored in the exact way objects are. If you're declaring them on the global scope (or maybe even within the {} scope as you created in this video), then yes, they will likely stay in memory, but declaring them inside of a function (which is after all a specialized object) will reallocate their memory when the function's scope is popped off of the stack. Assuming the function isn't alive for the entirety of your running application, the primitives won't live forever.
@thekwoka4707
@thekwoka4707 5 ай бұрын
Yes, he was just wrong on that. String literals are kept around (they exist directly in the code, so it's assumed they are likely to be used again), and also the console that the string was logged to is in memory as well, so the string is still in use in the console.
@aurelionsoul9125
@aurelionsoul9125 5 ай бұрын
recently learned Javascript, is it possible to make a pixelated multiplayer game, sandbox style or top down
@kirillvoloshin2065
@kirillvoloshin2065 4 ай бұрын
yes
@reactjs1900
@reactjs1900 5 ай бұрын
I really needed this. Thanks 👍
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 5 ай бұрын
Sure, only the best, and I am glad that I and you are the best.
@chaoliu2631
@chaoliu2631 4 ай бұрын
You hair looks amazing, how do you do your hair? tell me the brand of the wax or spay you are using if it is okay.
@sabuein
@sabuein 4 ай бұрын
Thank you, Kyle.
@yoooo4177
@yoooo4177 4 ай бұрын
Oh yay that means I’m one of the best developers! 🎉
@yoooo4177
@yoooo4177 4 ай бұрын
@yoooo4177 No you’re not
@aaronely759
@aaronely759 4 ай бұрын
This is why I started using web assembly instead of js
@underscore_e
@underscore_e 5 ай бұрын
Awesome video thank you so much!
@iTzBoosTerZx
@iTzBoosTerZx 5 ай бұрын
I never noticed how much you move your head when speaking, but now I can’t unsee it
@coderflix
@coderflix 4 ай бұрын
Exelent explanation! Thanks.
@DevChannel-b4i
@DevChannel-b4i 5 ай бұрын
Thanks for your awesome videos, dude!
@dead_holicx3127
@dead_holicx3127 4 ай бұрын
Really good video and very informative one. Thank you!
@hamzamukhtar4506
@hamzamukhtar4506 5 ай бұрын
Can you please make GC video for backend. And please make another video where we can use GC in real application. Thanks.
@TheMetalMag
@TheMetalMag 4 ай бұрын
ok does that affect local storage?
@gurusystem
@gurusystem 5 ай бұрын
The engine does GC before taking heap snapshot, you need to look at the retain path to see why there are three Test objects in memory. This video has multiple mistakes and inaccurate information. Please double check.
@ukaszzbrozek6470
@ukaszzbrozek6470 5 ай бұрын
Thank you! I had a blank spot in my knowledge.
@RG-vv4wcRG
@RG-vv4wcRG 5 ай бұрын
what do you think about SolidJS
@ev721
@ev721 5 ай бұрын
Damn! This was extremely informative.
@ppnwt
@ppnwt 5 ай бұрын
Great video !!!, Thank you
@yasseralsaidi
@yasseralsaidi 4 ай бұрын
nice, we need for network too!
@colindante5164
@colindante5164 5 ай бұрын
Thanks for the upload. ))
@potaetoupotautoe7939
@potaetoupotautoe7939 5 ай бұрын
dark mode plz, luv ur content btw
@yeabsragebriel32
@yeabsragebriel32 5 ай бұрын
It's best tutorial but can you make another js master like challenge or exercise even to master it 😊😊😊
@MinhNguyenTao
@MinhNguyenTao 5 ай бұрын
Okay. Now I think I'm one of the best developers.
@dweblinveltz5035
@dweblinveltz5035 5 ай бұрын
OK yo, I've been an JS engineer for years, I legit did not know you could just use curly braces by themselves to make a scope.
@karimbouche3563
@karimbouche3563 5 ай бұрын
Really interesting
@javascript_developer
@javascript_developer 3 ай бұрын
just awesome.
@thirdreplicator
@thirdreplicator 5 ай бұрын
Try wearing a neck brace.
@АнтонВолков-щ1ъ
@АнтонВолков-щ1ъ 4 ай бұрын
The way how you look for memory leaks doesn't have a lot of sense. You know that you have problem with map. But what if you don't?
@pankajwp
@pankajwp 5 ай бұрын
Gold
@6r31v1nZ
@6r31v1nZ 5 ай бұрын
why does anyone ever talks about memory leaks in JS?
@thekwoka4707
@thekwoka4707 5 ай бұрын
Lots of wrong things Your strings were kept in memory because they were string literals in the code, not because they were strings. Numbers are also collected, but don't have memory anyway, since they are raw pointers. You actually didn't talk at all about how garbage collection works in the section for "how garbage collection works".....
@NeoniumOxide
@NeoniumOxide 5 ай бұрын
Hi
@zeteya
@zeteya 4 ай бұрын
So you're the best is it now?
@Sankaritarina89
@Sankaritarina89 5 ай бұрын
you have a dog? 🤩
@WebDevSimplified
@WebDevSimplified 5 ай бұрын
I have had her for a few years. She usually sleeps in my office while I work, but tends to leave when I start recording videos since she doesn't like it when I move around all my lighting equipment. She must have been really tired when I recorded this, though, as she didn't move an inch.
@RobbPage
@RobbPage 5 ай бұрын
enough of the clickbait titles. please just say WHAT your video is about. I'd hate to unsub after all these years but i don't play that clickbait bullshit.
@Dorgrident
@Dorgrident 5 ай бұрын
"You must know this!" "Only The Best Developers Understand How This Works" I think its called clickbait and alot of people know how it works.
@bharatchakrabarthy7571
@bharatchakrabarthy7571 5 ай бұрын
Yeah i commented about the same thing on one of Kyles other video too where he kept the title too abstract and makes a soy face in the thumbnail. I don't understand why he can't just tell what the video is about in the title, will make it very easy to search in future and also know what I'm getting into before clicking the video.
@naught0
@naught0 5 ай бұрын
@@bharatchakrabarthy7571 Because that's not how you make money on youtube lol
@Azurryu
@Azurryu 5 ай бұрын
Especially in the web scene where many people get a job without being qualified developrers, these concepts and specifically how to profile their JavaScript is barely known. I've been working in a web agency and except for two of twendy developers nobody knew about let and const, didn't even how what a class is (neither in JavaScript nor the general concept). Most of them didn't even use var, their coding standard was just huge files of implicitly declared global variables and functions. His titles are useless clickbait though... none of these people will ever find his videos when specifically searching for such information, contributing to the mess by making useful information not usefully accessible.
@fullstacklarry
@fullstacklarry 5 ай бұрын
Thats who usually gets the jobs, people who don't know shit and might have a degree....
@thekwoka4707
@thekwoka4707 5 ай бұрын
Even worse that he's wrong on quite a lot of things and doesn't actually tell how garbage collection works...despite half the video being that section...
@solvedfyi
@solvedfyi 4 ай бұрын
I might be disliking every one I click on just because I hate the vague nondescript clickbait titles. So unbecoming.
@coladock
@coladock 5 ай бұрын
Tile "Best Developer". Me as a backend: ???
25 күн бұрын
You talk to much to fast monotonic, makes me sleepy
@kazmi401
@kazmi401 5 ай бұрын
ClickBait!
@designerjehovah4453
@designerjehovah4453 5 ай бұрын
How?
@aeronwolfe7072
@aeronwolfe7072 5 ай бұрын
omG!!!!!!!!!!! STOP!!!!!!!!!!! so many haters. GEEZ
@Malediction99
@Malediction99 5 ай бұрын
Bro, just buy another guitar stand.
@seandavidson3602
@seandavidson3602 5 ай бұрын
I always lose concentration on your videos when you pronounce the W in known and own etc. I just can't. I start googling trying to find out which dialect does this, and I'm told that none do. It;s just you. lol
@Benjamin-Chavez
@Benjamin-Chavez 4 ай бұрын
This was kinda unnecessary and rude.
@seandavidson3602
@seandavidson3602 4 ай бұрын
@@Benjamin-Chavez 👍OK, Boomer
@uditvish726
@uditvish726 5 ай бұрын
[].forEach.call( document.querySelectorAll('*'), function(el) { if (el.offsetWidth > docWidth) { console.log(el); } } );
@uditvish726
@uditvish726 5 ай бұрын
[].forEach.call( document.querySelectorAll('*'), function(el) { if (el.offsetWidth > docWidth) { console.log(el); } } );
@uditvish726
@uditvish726 5 ай бұрын
[].forEach.call( document.querySelectorAll('*'), function(el) { if (el.offsetWidth > docWidth) { console.log(el); } } );
@uditvish726
@uditvish726 5 ай бұрын
[].forEach.call( document.querySelectorAll('*'), function(el) { if (el.offsetWidth > docWidth) { console.log(el); } } );
@uditvish726
@uditvish726 5 ай бұрын
[].forEach.call( document.querySelectorAll('*'), function(el) { if (el.offsetWidth > docWidth) { console.log(el); } } );
Learn Event Delegation In 10 Minutes
9:57
Web Dev Simplified
Рет қаралды 62 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 489 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 7 МЛН
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
The Most Important Skill You Never Learned
34:56
Web Dev Simplified
Рет қаралды 219 М.
Finally Fix Your Issues With JS/React Memory Management 😤
20:13
Jack Herrington
Рет қаралды 88 М.
The 3 Laws of Writing Readable Code
5:28
Kantan Coding
Рет қаралды 747 М.
WTF Do These Even Mean
13:44
Web Dev Simplified
Рет қаралды 95 М.
How To Build Feature Flags Like A Senior Dev In 20 Minutes
20:33
Web Dev Simplified
Рет қаралды 98 М.
Node.js Doesn’t Suck Anymore
16:59
Web Dev Simplified
Рет қаралды 129 М.
Top 6 React Hook Mistakes Beginners Make
21:18
Web Dev Simplified
Рет қаралды 581 М.
Why More People Dont Use Linux
18:51
ThePrimeTime
Рет қаралды 318 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 703 М.
How To Debug React Apps Like A Senior Developer
21:07
Web Dev Simplified
Рет қаралды 173 М.