Test case name | Result |
---|---|
getElementById() | |
getElementsByClassName() | |
getElementsByTagName() | |
querySelector(#id) | |
querySelector(.id) | |
querySelectorAll(#id) | |
querySelectorAll(.id) | |
jQuery(#id) | |
jQuery(.id) | |
jQuery(tag#id) | |
jQuery(tag.id) | |
jQuery + getElementById | |
jQuery + getElementsByClassName | |
jQuery + querySelectorAll | |
querySelectorAll in function |
Test name | Executions per second |
---|---|
getElementById() | 1999591.2 Ops/sec |
getElementsByClassName() | 1576964.0 Ops/sec |
getElementsByTagName() | 1509362.4 Ops/sec |
querySelector(#id) | 894847.6 Ops/sec |
querySelector(.id) | 1193722.4 Ops/sec |
querySelectorAll(#id) | 560118.6 Ops/sec |
querySelectorAll(.id) | 650933.7 Ops/sec |
jQuery(#id) | 509794.1 Ops/sec |
jQuery(.id) | 300375.0 Ops/sec |
jQuery(tag#id) | 236997.5 Ops/sec |
jQuery(tag.id) | 252474.0 Ops/sec |
jQuery + getElementById | 636511.9 Ops/sec |
jQuery + getElementsByClassName | 173642.6 Ops/sec |
jQuery + querySelectorAll | 214246.8 Ops/sec |
querySelectorAll in function | 680490.4 Ops/sec |