Skip to content

Slick.match is SLOW #11

Open
Open
@markiz

Description

@markiz

Walking over whole DOM to look for a selector match is an overkill.

There're at least two better solutions:

  1. Launch the search from the given NODE over the REVERSED selector with cut off first part (it usually looks like * !~ ) -- saves ~50% of time in my benchmark. If it matches anything -- selector does what we want to.
    • Pros: no problems with compatibility
  2. Write a separate matcher or find a way to reuse existing finders (though, I couldn't figure it out myself)
    • Pros: the fastest way -- saves ~75% of time in my benchmark
    • Cons: not so DRY

I've got some code but it's very-very dirty (I'm not a js-er, actually) but I can add it as a proof of concept via gist if you need.

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions