vue-intersect icon indicating copy to clipboard operation
vue-intersect copied to clipboard

Lots of InteractionObservers

Open bobmoff opened this issue 6 years ago • 2 comments

Hi!

Was just wondering about this component, when used on page with lots of things to observe, like an image gallery of similar, it would create am InteractionObserver for each usage instead of reusing a single observer.

Do you know if this would matter that much to performance or so ?

Perhaps if the observer options are the same, it could reuse it for multiple elements ?

bobmoff avatar Apr 02 '18 11:04 bobmoff

@bobmoff, Yeah you're absolutely right. We might be better of having some sort of factory which creates Observes based on the configuration settings. This does however require some rewriting of the codebase and additional tests, but i think it's absolutely doable.

In my experience there is no direct performance implications when having multiple observes, but that of cause depends on the amount of observable elements that one might have.

tkjaergaard avatar Apr 09 '18 06:04 tkjaergaard

I didn't hit any performance problems even when using thousands of intersection observers. It didn't show up in profiling at all.

MartinMalinda avatar Aug 12 '21 08:08 MartinMalinda