Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0
Firefox 137
Linux
Desktop
10 days ago
Test name Executions per second
createTextNode 2633878.0 Ops/sec
textContent 4010845.0 Ops/sec
innerText 2354223.8 Ops/sec
append 4411581.0 Ops/sec
new text 3411447.5 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'));