Split strong to chars

Benchmark created on


Setup

const str = 'hello world'; // '𝟘𝟙𝟚𝟛';
const regex = /(?=[\s\S])/u;

Test runner

Ready to run.

Testing in
TestOps/sec
Spread
const a = [...str];
ready
Array from
const a = Array.from(str);
ready
Regex split
const a = str.split(regex);
ready
Object assign
const a = Object.assign([], str);
ready
For..of reduction
const a = [];
for (const s2 of str) {
   a.push(s2);
}
ready
Basic split
const a = str.split('');
ready
Prototype slice
const a = Array.prototype.slice.call(str);
ready

Revisions

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