Skip to content

Iterating over a large HTMLCollection is slow #36609

@jdm

Description

@jdm

From the testcase in #36480, this snippet takes ~5s to execute in a release build:

let timestamps = document.getElementsByTagName("time");
for(let r of timestamps) {
let dt = new Date(parseInt(r.getAttribute("ms")));
dt.setMinutes(dt.getMinutes() - dt.getTimezoneOffset())
r.innerText = dt.toISOString().slice(0, 19).replace("T", " ");
}

Surprisingly, one of the biggest contributors to the profile on macOS is the assert_in_script function; specifically style::thread_state::get().

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/domInteracting with the DOM from web contentI-perf-slowUnnecessary performance degredation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions