Skip to content

v1.0.2

Choose a tag to compare

@github-actions github-actions released this 01 Jun 10:58
· 10 commits to main since this release
396bcc6

A performance release. No API changes; results are identical to 1.0.1.

Performance

Attribute predicates — the dominant shape Capybara's selector builder emits
(./@id, ./@type, ./@name, ./@href, …) — no longer materialize an
attribute-axis node-set per candidate node. @name <op> literal and @name
existence are now resolved with a single getAttribute call, and the ./@name
form (a leading no-op self::node() step) takes the same fast path as the bare
@name.

On the capybara-simulated field selector (300-block page), this collapses the
attribute predicates:

predicate 1.0.1 1.0.2
[not(@type…)] 2321µs 454µs
[@id/@name…] 4199µs 472µs
field selector (whole) 5513µs 1685µs

Also in this release:

  • node-set predicates such as self::input | self::textarea | self::select are
    evaluated by existence (short-circuit), without materializing a node-set;
  • the HTML-document flag is computed once per evaluation and cached on the
    context.

vs. wgxpath

Measured against the engine xpathway replaces, on the same page with matching
result counts: the field selector is ~54.7× faster (1685µs vs 92178µs) and
the link selector ~2.08× faster. wgxpath re-scans //label[…]/@for once per
candidate input; xpathway hoists it once per evaluation.

Correctness / docs

  • Documented the adapter invariant the attribute fast path relies on: an adapter
    reporting an HTML document must key attributes case-insensitively (lower case),
    so getAttribute(el, null, 'type') finds an attribute written TYPE.

Full Changelog: v1.0.1...v1.0.2