Skip to content

Improve tracking performance and simplify tracking implementations

Jeremy Jackson requested to merge tracking-performance into master

What does this MR do?

It restructures how event tracking is handled at a document level. The new implementation binds 3 events at the document level and is an improvement over locating and binding events to individual elements in that it reduces memory leaks if an element with an event listener is removed, reduces the risk and potential rebinding of events, and improves performance by removing specific element lookup. The approach now simply disregards events if there's no tracking data present on the event target (or ancestor).

Since we now have the capability to track events on re-renders, it allows us to clean up tracking code in several places. It also removes jQuery as a dependency within all tracking code.

EE -> https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15759

Documentation will be updated in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32117 as we work out the details of this MR.

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

There's some interesting performance implications. While this is definitely an improvement over the existing event tracking logic that searches for elements, there's likely a very low level performance impact on every click event. If needed, we can do a little bit of work to minimize the expense of using closest by manually reducing this to a lower number of elements.

Merge request reports