Array.from vs Spread Operator Benchmark
{"ScriptPreparationCode":" for (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n const elem = document.createElement(\u0027div\u0027);\r\n elem.className = \u0027someClassedElements\u0027;\r\n document.body.appendChild(elem);\r\n }","TestCases":[{"Name":"Spread","Code":"function benchmarkSpreadOperator() {\r\n const start = performance.now();\r\n for (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const elements = [...document.querySelectorAll(\u0027.someClassedElements\u0027)];\r\n }\r\n const end = performance.now();\r\n return end - start;\r\n}\r\nconst spreadOperatorTime = benchmarkSpreadOperator();\r\nconsole.log(\u0060Spread Operator: ${spreadOperatorTime}ms\u0060);","IsDeferred":false},{"Name":"Array.from","Code":"function benchmarkArrayFrom() {\r\n const start = performance.now();\r\n for (let i = 0; i \u003C 1000; i\u002B\u002B) {\r\n const elements = Array.from(document.querySelectorAll(\u0027.someClassedElements\u0027));\r\n }\r\n const end = performance.now();\r\n return end - start;\r\n}\r\nconst arrayFromTime = benchmarkArrayFrom();\r\nconsole.log(\u0060Array.from: ${arrayFromTime}ms\u0060);","IsDeferred":false}]}