Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Regex whitespace check vs trim length
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 143
Operating system:
Android
Device Platform:
Mobile
Date tested:
7 months ago
trim
37.0M/s
regex
31.1M/s
View exact numbers
Test name
Executions per second
✓
trim
37,019,048 Ops/sec
regex
31,050,934 Ops/sec
Script Preparation code:
var str = ' fsajdf asdfjosa fjoiawejf oawjfoei jaosdjfsdjfo sfjos 2324234 sdf safjao j o sdlfks dflks l '
Tests:
regex
!/\S/.test(str)
trim
!!str.trim().length