Skip to content
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

VizIR is super slow. #7712

Closed
mcourteaux opened this issue Jul 26, 2023 · 3 comments · Fixed by #7754
Closed

VizIR is super slow. #7712

mcourteaux opened this issue Jul 26, 2023 · 3 comments · Fixed by #7754

Comments

@mcourteaux
Copy link
Contributor

mcourteaux commented Jul 26, 2023

Loading a page takes me about 12 seconds on a high-end desktop.
I recorded what's happening in Chromium with the performance profiler in the Developer Tools.

Trace-20230726T110312.json.zip

The first half of the time (below in green rectangle) is spent in init_tooltips, which calls out to some jQuery which takes all the time in querySelectorAll. The piece of offending code, according to the profile, is this one:

        function init_tooltips(btns, prefix) {
            var re = /(?:\-([^-]+))?$/;
            for (var i = 0; i < btns.size(); i++) {
                const button = btns[i];
                const tooltip = $(prefix + re.exec(button.id)[1])[0];
                button.is_clicked = false;
                button.addEventListener('mouseenter', ()=>{
                    if (!button.is_clicked)
                        showTooltip(button, tooltip);
                }
                );
                button.addEventListener('mouseleave', ()=>{
                    if (!button.is_clicked)
                        hideTooltip(tooltip);
                }
                );
                button.addEventListener('click', ()=>{
                    if (button.is_clicked) {
                        hideTooltip(tooltip);
                        button.is_clicked = false;
                    } else {
                        showTooltip(button, tooltip);
                        button.is_clicked = true;
                    }
                }
                );
            }
        }

The culprit is the $() call, I assume.

Second half of the time is spent in the same querySelectorAll but without a parent call.

image

@mcourteaux
Copy link
Contributor Author

@maaz139 I think you made this tool?

@mcourteaux
Copy link
Contributor Author

I'm working on this. Will open a Draft PR where I can document progress.

@mcourteaux
Copy link
Contributor Author

#7713

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 a pull request may close this issue.

1 participant