Skip to content

Performance optimizations #1

@purefn

Description

@purefn

Currently, there are optimizations being done.

At least one optimization would be to determine if the selector contains is
just a simple id selector and use getElementById() if the element being
searched is the document root.

Another possibility is to do some indexing of the document before any
selectors are run on it so we can have more information about the document
a priori. Things like which elements have which classes and other common
attributes would be useful.

Also, currently nth-child and friends are slower than they need to be
because the index of an element is calculated during matching. It could
easily be calculated during iteration instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions