Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.60 YaBrowser/20.12.0.1065 Yowser/2.5 Safari/537.36
Yandex Browser 20
Mac OS X 10.15.6
Desktop
3 years ago
Test name Executions per second
Traverse function 58921.2 Ops/sec
NodeIterator with filter function 11482.4 Ops/sec
NodeIterator with filter param 388138.9 Ops/sec
TreeWalker with filter function 28065.1 Ops/sec
TreeWalker with filter param 392786.0 Ops/sec
Script Preparation code:
Tests:
  • Traverse function

  • NodeIterator with filter function

  • NodeIterator with filter param

  • TreeWalker with filter function

  • TreeWalker with filter param