Skip to content

Found bottleneck in core algo #134

@botandrose

Description

@botandrose

While profiling BARD Tracker on a particularly large DOM morph, I discovered that ~90% of the morph time was being spent in findBestMatch, specifically: if (cursor.contains(document.activeElement)) break; in findBestMatch. I've just commented it out in my local copy of idiomorph to fall back on focus restoration, but I want to explore how we might keep the functionality of native focus preservation without the slowdown. Maybe precomputing the active element's parents up to the morph root into a set, and looking for set inclusion of the cursor?

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