Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
trim() vs trimEnd
(version: 1)
Comparing performance of:
trim() vs trimEnd()
Created:
7 months ago
by:
Guest
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
test_string = "{this is a test string}\n"
Tests:
trim()
let endsInBracket = test_string.trim().endsWith('}')
trimEnd()
let endsInBracket = test_string.trimEnd().endsWith('}')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
trim()
trimEnd()
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Browser/OS:
Chrome 143 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
trimEnd()
133.4M/s
trim()
125.0M/s
View exact numbers
Test name
Executions per second
✓
trimEnd()
133,422,448 Ops/sec
trim()
125,039,104 Ops/sec
Related benchmarks
Regex detecting whitespace vs trim
Trim vs regex
Regex whitespace check vs trim length
slice substring trim both ends
trim() vs double-comparison
Comments
Confirm delete:
Do you really want to delete benchmark?