Test name | Executions per second |
---|---|
cloneNode(true) | 131.6 Ops/sec |
innerHTML | 99.1 Ops/sec |
var str = `<div>${Math.random().toString().slice(2)}</div>`;
var temp = document.createElement('template')
var res = '';
for(i=0; i<30000; i++){
res += str
}
temp.innerHTML = res;
var div = document.createElement('div')
div.append(temp.content.cloneNode(true));
div.innerHTML = res;