Spread vs Concat (v2)

Revision 2 of this benchmark created on


Preparation HTML

<div id="el" class="foo bar">content</div>

Setup

const tag = document.getElementById('el');

Test runner

Ready to run.

Testing in
TestOps/sec
spread
[tag.nodeName, ...Array.from(tag.classList).sort()].join('.');
ready
concat
[tag.nodeName].concat(Array.from(tag.classList).sort()).join('.');
ready
double spread
[tag.nodeName, ...[...tag.classList].sort()].join('.');
ready

Revisions

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