Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Chrome 95
Mac OS X 10.14.6
Desktop
3 years ago
Test name Executions per second
Traverse function 79435.8 Ops/sec
NodeIterator with filter function 12765.1 Ops/sec
NodeIterator with filter param 506002.1 Ops/sec
TreeWalker with filter function 39765.1 Ops/sec
TreeWalker with filter param 650247.6 Ops/sec
Script Preparation code:
Tests:
  • Traverse function

  • NodeIterator with filter function

  • NodeIterator with filter param

  • TreeWalker with filter function

  • TreeWalker with filter param