Jurgen Treep genuinely one of my favourite t-shirts. Big fan of the work those folks do.
@jurgentreep7 жыл бұрын
I should probably have said smile since I feel the same way.
@wmhilton-old7 жыл бұрын
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.
@victornpb7 жыл бұрын
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.
@jakearchibald7 жыл бұрын
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.
@victornpb7 жыл бұрын
Jake Archibald I also ended up using weakmap because I also hold some metadata of each node
@kamoroso946 жыл бұрын
This was really helpful for me to figure out why one would need to use a WeakMap or WeakSet for anything.
@MinusTechTips6 жыл бұрын
i love how they are freely referencing facebook and mozilla and their products. *ehm microsoft ehm*
@code-wiki85886 жыл бұрын
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.
@aammssaamm5 жыл бұрын
google.com ? :)
@ChunkyChest7 жыл бұрын
so, do you know...... no ... good, next topic
@omri93257 жыл бұрын
You guys are talking a bit unclearly, could you add subtitles or something? I really had hard time hearing/understanding what you are saying.
@dassurma7 жыл бұрын
Sorry for our mumbling! Subtitles are being worked on as we speak, they usually show up within 1 or 2 days :)
@omri93257 жыл бұрын
Much appreciated!
@aammssaamm5 жыл бұрын
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.
@joonae51137 жыл бұрын
WeakMap working the other way around would solve the other (999/1000) usecases
@victornpb7 жыл бұрын
It doesn't make sense for me
@arkadymagomedov17002 жыл бұрын
exactly!
@nigelmrodgers4 жыл бұрын
huh?
@sfincione20007 жыл бұрын
It's quite funny to watch you guys pretend to not know this stuff =)
@CodingPhase6 жыл бұрын
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
@MinusTechTips6 жыл бұрын
wtf CodingPhase, did you even read the comment? quickly jump into keyboard warrior mode much?
@aammssaamm5 жыл бұрын
@@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.