Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Regexp vs split cookie
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/139.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 139
Operating system:
Android
Device Platform:
Mobile
Date tested:
one month ago
Test name
Executions per second
Regexp
70146.9 Ops/sec
Split
73320.5 Ops/sec
Script Preparation code:
var cookie = 'intercom-id-mrtzdw2q=c2be8491-1730-4343-b16e-1c708643318e; token=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsImtpZCI6IjhjMTgyMTY1YWNmN2U3Yjg3NzkwNzcxNWFmZWRiNzhmIn0.e30.McvbBVzvGzsawYch7ToCgtCrUicIQZ3_wNBV93fVBMm90JTldSpzdDgXd0eY7au1AxQst08mH-7FVy4C8wr4EQ; intercom-session=acj; intercom-session-mq='
Tests:
Regexp
const TOKEN_REGEXP = /token=(\S+)/ const [, token] = TOKEN_REGEXP.exec(cookie) console.log(token)
Split
const token = cookie?.split('token=')[1] ? cookie.split('token=')[1].split(';')[0] : undefined console.log(token)