Files
browser/src
Karl Seguin 1105aec02b perf: improve nth-* CSS selector performance
This adds an NthCache which will cache the ordinal position of elements. Only
nodes which have >= 32 sibblings are cached - the cache has performance/memory
overhead and for smaller nodes, walking is cheaper.

Using the new benchmark: https://github.com/lightpanda-io/demo/pull/245 under
particularly bad conditions (W=4000):

main:
  case                      match   iters    us/query
  :nth-child(2n)             2000       2     55862.5
  :nth-of-type(2n)           1999       2     57675.0
  :nth-last-of-type(2n)      1999       2     53935.0
  ancestor :nth-child(2n)    4000       1    111855.0
  list of two nth            2667       1    111180.0

PR:
  case                      match   iters    us/query
  :nth-child(2n)             2000     258       388.1
  :nth-of-type(2n)           1999     245       409.6
  :nth-last-of-type(2n)      1999     245       409.0
  ancestor :nth-child(2n)    4000     168       596.1
  list of two nth            2667     160       626.8

Firefox
  case                      match   iters    us/query
  :nth-child(2n)             2000     460       217.4
  :nth-of-type(2n)           1999     445       224.7
  :nth-last-of-type(2n)      1999     260       384.6
  ancestor :nth-child(2n)    4000     246       406.5
  list of two nth            2667     294       340.1

With no regressions in the other cases.
2026-09-08 20:43:30 +08:00
..
2026-08-29 10:48:36 +08:00
2026-08-31 22:44:59 +08:00
2026-09-07 11:14:15 +03:00
2026-08-31 22:44:59 +08:00
2026-09-05 17:51:47 +08:00
2026-08-19 21:49:02 +08:00
2026-07-30 13:02:13 +08:00
2026-07-22 13:26:03 +08:00
2026-08-31 22:44:59 +08:00
2026-08-31 22:45:14 +08:00
2026-07-22 13:26:03 +08:00
2026-08-31 22:44:59 +08:00
2026-09-04 06:59:37 -07:00
2026-07-22 13:26:03 +08:00
2026-07-22 13:26:03 +08:00
2026-09-07 11:01:03 +03:00
2026-08-31 22:44:59 +08:00
2026-08-31 22:44:59 +08:00
2026-07-22 13:26:03 +08:00
2026-07-22 13:26:03 +08:00
2026-08-22 07:04:58 +08:00