Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Bearer Token Strip
(version: 0)
Comparing performance of:
Replace vs Split
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var token = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5NjIwOGMwNTkzZWIyNDZjOWQ0ZTc1YmJhMmM0NDQ3MGJjMmVjZWY1YjI1YWYxMTYyZjk4ZTgyNDAyYjNjMWYiLCJpYXQiOjE3MDMxNDAwNDMsImV4cCI6MTcxMDkxNjA0M30.zuRKSUDRUL7yIF_aISawc6xuVVIk-RZg8G8cRoV79EgeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5NjIwOGMwNTkzZWIyNDZjOWQ0ZTc1YmJhMmM0NDQ3MGJjMmVjZWY1YjI1YWYxMTYyZjk4ZTgyNDAyYjNjMWYiLCJpYXQiOjE3MDMxNDAwNDMsImV4cCI6MTcxMDkxNjA0M30.zuRKSUDRUL7yIF_aISawc6xuVVIk-RZg8G8cRoV79Eg'
Tests:
Replace
const a = token.replace(/^Bearer\s/, '');
Split
const b = token.split(' ')[1];
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Replace
Split
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Browser/OS:
Chrome 119 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Replace
2776168.2 Ops/sec
Split
16673775.0 Ops/sec
Related benchmarks:
Remove bearer prefix from JWT token
Regexp vs split cookie
Token from cookie
JWT token Split vs Basic string replace
Comments
Confirm delete:
Do you really want to delete benchmark?