Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
js slice performance
show slice performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
slice-1
32.9M/s
slice-2
32.1M/s
slice-3
31.5M/s
View exact numbers
Test name
Executions per second
✓
slice-1
32,937,148 Ops/sec
slice-2
32,112,870 Ops/sec
slice-3
31,549,872 Ops/sec
Script Preparation code:
function randomString(e) { e = e || 32; var t = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678", a = t.length, n = ""; for (i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a)); return n } var str1 = randomString(100) var str2 = randomString(100000) var str3 = randomString(100000000)
Tests:
slice-1
var result1 = str1.slice(1, 3) var result2 = str1.slice(4, 6) var result3 = str1.slice(7, 10)
slice-2
var result1 = str2.slice(1, 30000) var result2 = str2.slice(28999, 69999) var result3 = str2.slice(67000, 99999)
slice-3
var result1 = str2.slice(1, 30000000) var result2 = str2.slice(28999000, 69999000) var result3 = str2.slice(67000000, 99999000)