Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Split vs Substr+IndexOf Performance 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Browser:
Firefox 121
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Substring
26.4M/s
Substring 2
25.7M/s
Split
19.1M/s
View exact numbers
Test name
Executions per second
✓
Substring
26,423,322 Ops/sec
Substring 2
25,712,008 Ops/sec
Split
19,078,330 Ops/sec
Script Preparation code:
var s1 = "28.9% CPU samples were in `Array.Sort` called from `DiagService.Controllers.PerfCPUController.CpuTask`. We expect this value to be less than 0.7%."
Tests:
Split
var resultSplit = s1.split[1];
Substring
var resultSubstr = s1.substring(s1.indexOf('`') + 1, s1.indexOf('`', s1.indexOf('`') + 1))
Substring 2
var i = s1.indexOf('`') + 1; var resultSubstr = s1.substring(i, s1.indexOf('`', i))