Skip to content

VizIR is super slow. #7712

@mcourteaux

Description

@mcourteaux

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions