Run details:
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36
Chrome 88
Windows 8.1
Desktop
3 years ago
Test name Executions per second
Traverse function 39422.5 Ops/sec
NodeIterator with filter function 6373.0 Ops/sec
NodeIterator with filter param 257155.5 Ops/sec
TreeWalker with filter function 17569.9 Ops/sec
TreeWalker with filter param 289943.2 Ops/sec
Script Preparation code:
Tests:
  • Traverse function

  • NodeIterator with filter function

  • NodeIterator with filter param

  • TreeWalker with filter function

  • TreeWalker with filter param