fix(GlIntersectionObserver): improve GlIntersectionObserver performance

Description

This MR greatly improves the performance of GlIntersectionObserver by allowing component instances to share the same IntersectionObserver instance.

This kind of optimization was implemented for ResizeObserver where we learned a lot about how these observers are meant to be used.

See the related issue for more details #676 (closed).

/cc @samdbeckham

Screenshots

The number in these tables represent the intersection "ratio" returned from the intersection observer 👇

Notice that for the first example, it takes a long time for the numbers to change because an IntersectionObserver is created for every instance.

Observers created for every instance (on master) Observers shared (this MR)
20200311_lots_of_intersection_observers_slow 20200311_shared_intersection_observer
Edited by Paul Slaughter

Merge request reports

Loading