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:
4 months ago
by:
Guest
Jump 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:
4 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
Test name
Executions per second
trim()
125039104.0 Ops/sec
trimEnd()
133422448.0 Ops/sec
Related benchmarks:
Regex detecting whitespace vs trim
substring vs slice
Regex removing whitespace vs trim v3
Regex Checking whitespace vs trim
first and last character
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?