substr_slice

Benchmark created by tinybeans on


Test runner

Ready to run.

Testing in
TestOps/sec
sbstr
var text = 'あいうえお';
var ins = '12345';
var res = text.substr(0, 3) + ins + text.substr(3);
ready
slice
var text = 'あいうえお';
var ins = '12345';
var arry = text.split('');
var n = 3 - 1;
var pos = arry[n];
arry.splice(n, 1, pos + ins + '');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by tinybeans on