Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
Firefox 123
Ubuntu
Desktop
2 years ago
Benchmark.js
native - cached.
799.9M/s
native - global
7.7M/s
jQuery - find ~ cached.
1.9M/s
jQuery - using context.
1.5M/s
jQuery - find ~ without cache.
1.5M/s
jQuery init after using native DOM
816K/s
jQuery - using data attributes.
613K/s
View exact numbers
Test name Executions per second
native - cached. 799,857,216 Ops/sec
native - global 7,660,368 Ops/sec
jQuery - find ~ cached. 1,852,631 Ops/sec
jQuery - using context. 1,538,802 Ops/sec
jQuery - find ~ without cache. 1,509,442 Ops/sec
jQuery init after using native DOM 815,920 Ops/sec
jQuery - using data attributes. 612,837 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: