jQuery Val vs Vanilla JS

Benchmark created by Doron on


Preparation HTML

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>

        <input type="text" name="test" id="test" value="" />

    </body>
</html><script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var id = 30000

Test runner

Ready to run.

Testing in
TestOps/sec
Vanilla JS
                    var idInput = document.getElementById("test");
                    idInput.value = id;
ready
jQuery
$("#test").val(id);
ready

Revisions

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