Script Preparation code:
AخA
 
var position = 20;
var testString = "А еще можно символы в массиве хранить. Сплайсом вставлять символ и джойнить перед выводом";
var testArray = testString.split ``;
var newChar = "X";
Tests:
  • Массивы

     
    testArray.splice(position, 0, newChar);
    let result = testArray.join``;
  • Строки

     
    let result = testString.substring(0, position) + newChar + testString.substring(position)
  • Slice

     
    let result = testString.slice(0, position) + newChar + testString.slice(position)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Массивы
    Строки
    Slice

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 14 days ago)
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36
Chrome Mobile 134 on Android
View result in a separate tab
Test name Executions per second
Массивы 2193.3 Ops/sec
Строки 23346570.0 Ops/sec
Slice 13101584.0 Ops/sec