querySelectorAll_radio_checkbox-test

Benchmark created on


Preparation HTML

<!DOCTYPE html>
<html>
<head>
    <title>Тест производительности javascript</title>
    <meta charset="utf-8">
</head>
<body>
    <div class="block"></div>
    <div class="block"></div>
    <div class="block"></div>
    <div class="block"></div>
    <div class="block"></div>

    <div id="a1">
        <input type="radio">
        <input type="radio">
        <input type="radio">
        <input type="radio">
        <input type="radio">
    </div>

    <div id="a2">
        <input type="checkbox">
        <input type="checkbox">
        <input type="checkbox">
        <input type="checkbox">
        <input type="checkbox">
    </div>

    <div id="a3">
        <input type="text">
        <input type="text">
        <input type="text">
        <input type="text">
        <input type="text">
    </div>
</body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
for
var radio_checkbox = []
for(var j=0, inputs = document.getElementsByTagName("input"), len = inputs.length;j<len;j++){
    var type = inputs[j].type
    if(type=="radio" || type=="checkbox"){
    radio_checkbox.push(inputs[j])
    }
}
ready
querySelectorAll
var el = document.querySelectorAll("input[type='radio'],input[type='checkbox']")
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.