I thought WeakMaps worked exactly like Surma did! I'm so enlightened. I feel like I'm at the right level to really enjoy/benefit from these discussions. Thanks so much for this series.
I had an algorithm that recursively traverse a cyclic object, so I had to keep track of visited objects, I used to push it to an array, then check visitedNodes.indexOf(obj) but I can just replace replaced it with a set. I had no reason to use the WeakSet per se because I'm not leaking memory, but @bmeurer at V8 said it is cheaper because It doesn't have to keep iteration order. Another use case is for implementing event buses, that doesn't leak memory when the handler goes out of scope.
Your understanding is clearly not the focus. They are just having fun without realizing it may not be what people come here for. Sometimes it looks even rather disgusting than fun.
i don't understand what makes you think they don't know what they talking about? like you are in your moms basement they working for google... like stfu
Jake with the
Jurgen Treep genuinely one of my favourite t-shirts. Big fan of the work those folks do.
I should probably have said smile since I feel the same way.
I thought WeakMaps worked exactly like Surma did! I'm so enlightened. I feel like I'm at the right level to really enjoy/benefit from these discussions. Thanks so much for this series.
I had an algorithm that recursively traverse a cyclic object, so I had to keep track of visited objects, I used to push it to an array, then check visitedNodes.indexOf(obj) but I can just replace replaced it with a set. I had no reason to use the WeakSet per se because I'm not leaking memory, but @bmeurer at V8 said it is cheaper because It doesn't have to keep iteration order.
Another use case is for implementing event buses, that doesn't leak memory when the handler goes out of scope.
I think I wrote a very similar piece of code last week - cloning an object with circular references. I used a WeakMap to track cloned objects.
Jake Archibald I also ended up using weakmap because I also hold some metadata of each node
This was really helpful for me to figure out why one would need to use a WeakMap or WeakSet for anything.
i love how they are freely referencing facebook and mozilla and their products. *ehm microsoft ehm*
so, do you know...... no ... good, next topic
Hey guys,
Can u guide me to a webpage or a blog where i can learn more about how to efficiently use javascript for memory management in v8.
google.com ? :)
huh?
WeakMap working the other way around would solve the other (999/1000) usecases
It doesn't make sense for me
exactly!
You guys are talking a bit unclearly, could you add subtitles or something? I really had hard time hearing/understanding what you are saying.
Sorry for our mumbling! Subtitles are being worked on as we speak, they usually show up within 1 or 2 days :)
Much appreciated!
Your understanding is clearly not the focus. They are just having fun without realizing it may not be what people come here for. Sometimes it looks even rather disgusting than fun.
It's quite funny to watch you guys pretend to not know this stuff =)
i don't understand what makes you think they don't know what they talking about? like you are in your moms basement they working for google... like stfu
wtf CodingPhase, did you even read the comment? quickly jump into keyboard warrior mode much?
@@CodingPhase When did a google's title become a guarantee of an expertise? I have same opinion on already more than one topic they discussed.
Nonsense!