Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
Chrome 100
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
createContextualFragment 35.9 Ops/sec
innerHTML 37.2 Ops/sec
Script Preparation code:
AخA
 
var str = `<div>${Math.random().toString().slice(2)}</div>`;
var range = document.createRange();
var temp = document.createElement('template')
var res = '';
for(i=0; i<30000; i++){
    res += str
}
Tests:
  • createContextualFragment

     
    var test1 = range.createContextualFragment(res)
  • innerHTML

     
    temp.innerHTML = res
    var test2 = temp.content