Does increasing amount of ReactiveVars affect performance?

Hi!

I have a template that currently has 16+ ReactiveVars. Just curious if anyone knows how this affects performance?

Lest the memory overhead, I’d imagine that the more ReactiveVars you have than the more the Tracker has to observe for changes and consequently report said changes to Blaze. I’d think this can then hog up DDP and possibly slow things down and affect reactivity and UX.

Anybody know the technical details on this? Thanks!

I think it matters more how often you change the values. Having multiple reactive cars is a good way to ensure you don’t have over reactivity when fields change that you don’t care about.

I’m curious why you didn’t use a single ReactiveDict with 16 keys?

You’d only have to worry about this if you are making Meteor.calls in an autorun that depends on the ReactiveVars

3 Likes

Just inherited code that uses the 16+ inherited vars. I agree ReactiveDict or simply a ReactiveVar {} would be the way to go.

Your Meteor.calls in autorun blurb makes perfect sense, thanks!

1 Like

My commiserations. Been there too :laughing:

1 Like