Skip to content

WIP: 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. This is an improvement over locating elements and binding events to those 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 element lookup and instead disregarding events if there's no tracking data present on the event target (or ancestor).

Additionally, this cleans up a lot of tracking code that's no longer required. Since we're providing the capability to track events even on re-renders, this can be simplified. It also removes jQuery as a dependency within all tracking code.

Documentation will be updated in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32117 as we work out the details of this MR. After this is mostly approved, I'll open a matching MR in CE.

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

There's interesting performance implications. While this is definitely an improvement over the existing event tracking logic that searches for elements, there's a 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 looking up a finite number of elements.

Edited by Jeremy Jackson

Merge request reports