Skip to content

Memoizes the functions for getting header both runs and scalar data tables #6835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

hoonji
Copy link
Member

@hoonji hoonji commented Apr 21, 2024

Motivation for features / changes

Using functions in Angular templates leads to unnecessary recomputation, e.g. getHeaders() is called 60 times from data tables on init and add). More seriously, they also interfere with other component usage like CDK Overlay: namely, when an Overlay is set to appear next to a header, the header element is destroyed and recreated (because of the function in the template) before the Overlay can position itself, and ends up always resetting its position to (0,0). Simply memoizing the function will prevent the recomputation (Angular ref).

Profiling the memoized change (using Chrome devtools profiler, which is admittedly a bit inconsistent) seems to show a several 100ms improvement in scripting performance.

Technical description of changes

Replaces the getHeaders functions used in scalar/runs data tables with a new memoized extendHeaders(headers) function.

No change in UI behavior.

Screenshots of UI changes (or N/A)

N/A

@hoonji hoonji closed this Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant