Vue 3.3.6 Faster Thanks To WeakMaps

Tom Smykowski
7 min readOct 22, 2023

Performance improvements and type checking for additional attributes of DOM nodes make new Vue worth of an update

Vue team really did a lot of work. In fact, they releases two subversions on one day. Vue 3.3.5 and 3.3.6 were both released on 20.10.2023.

WeakMaps

One of the things that got improved is a move from Maps and Sets to WeakMaps and WeakSets when possible.

So what is that and why it’s important?

If you store stuff in Maps or Sets you make a reference to this stuff. Meaning, as long as a Map or Set is used, this stuff won’t be released from the memory with the garbage collector.

Usually it makes sense. But sometimes it doesn’t. Especially when you write some kind of code that just taps into the regular workflow of the data. For example by adding diagnostics data into data that flow through the system.

You want the data to be released wheneven needed, you don’t want to reserve the right to keep the data until you need it.

That’s where WeakMaps and WeakSets come into play and Vue now uses these more internally to prevent memory leaks and improve overall performance.

Support for…

--

--

Tom Smykowski
Tom Smykowski

Written by Tom Smykowski

Software Engineer & Tech Editor. Top 2% on StackOverflow, 3mil views on Quora. Won Shattered Pixel Dungeon.

No responses yet