addClass - Sprint.js vs vanilla JavaScript

Benchmark created by Benjamin De Cock on


Preparation HTML

<p class=foo></p>

<script src="https://sprintjs.com/prod"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
Sprint
Sprint(".foo").addClass("bar")
ready
Vanilla JavaScript
[].forEach.call(document.querySelectorAll(".foo"), function(el) {
  el.classList.add("bar")
})
ready

Revisions

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