Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0
Chrome 138
Windows
Desktop
one year ago
Benchmark.js
native - global
25.9M/s
native - cached.
25.8M/s
jQuery - find ~ cached.
1.6M/s
jQuery - find ~ without cache.
1.4M/s
jQuery init after using native DOM
1.3M/s
jQuery - using context.
1.1M/s
jQuery - using data attributes.
688K/s
View exact numbers
Test name Executions per second
native - global 25,943,236 Ops/sec
native - cached. 25,822,830 Ops/sec
jQuery - find ~ cached. 1,564,850 Ops/sec
jQuery - find ~ without cache. 1,434,935 Ops/sec
jQuery init after using native DOM 1,348,433 Ops/sec
jQuery - using context. 1,126,284 Ops/sec
jQuery - using data attributes. 688,067 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: