Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Chrome 128
Mac OS X 10.15.7
Desktop
6 months ago
Test name Executions per second
createTextNode 1747603.6 Ops/sec
textContent 6730485.5 Ops/sec
innerText 2880550.5 Ops/sec
append 3877092.2 Ops/sec
new text 1677528.9 Ops/sec
Script Preparation code:
AخA
 
var a = document.createElement('a');
Tests:
  • createTextNode

     
    a.appendChild(document.createTextNode('text'));
  • textContent

     
    a.textContent = 'text';
  • innerText

     
    a.innerText = 'text';
  • append

     
    a.append('text');
  • new text

     
    a.appendChild(new Text('text'));