Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Chrome 76
Mac OS X 10.14.3
Desktop
5 years ago
Test name Executions per second
Traverse function 69158.1 Ops/sec
NodeIterator with filter function 12272.1 Ops/sec
NodeIterator with filter param 472573.0 Ops/sec
TreeWalker with filter function 32735.9 Ops/sec
TreeWalker with filter param 514353.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