Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
normalize / trim text
(version: 7)
Comparing performance of:
no vs normalize vs trim vs both 1 vs both 2
Created:
one year ago
by:
Registered User
Jump to the latest result
Script Preparation code:
function makeid(length) { let result = ''; const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 '; const charactersLength = characters.length; let counter = 0; while (counter < length) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); counter += 1; } return result; } var data = Array(10000).fill(Array(40).fill(makeid(1000))) var rows = [] var row = {}
Tests:
no
data.forEach((items) => {items.forEach((item,i)=>{row[i] = item}); rows.push(row)})
normalize
data.forEach((items) => {items.forEach((item,i)=>{row[i] = item.normalize()}); rows.push(row)})
trim
data.forEach((items) => {items.forEach((item,i)=>{row[i] = item.trim()}); rows.push(row)})
both 1
data.forEach((items) => {items.forEach((item,i)=>{row[i] = item.normalize().trim()}); rows.push(row)})
both 2
data.forEach((items) => {items.forEach((item,i)=>{row[i] = item.trim().normalize()}); rows.push(row)})
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
no
normalize
trim
both 1
both 2
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser/OS:
Chrome 130 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
no
50.4 Ops/sec
normalize
3.0 Ops/sec
trim
37.0 Ops/sec
both 1
3.0 Ops/sec
both 2
3.0 Ops/sec
Related benchmarks:
Digit extraction
Text.data vs Text.nodeValue
Lodash _.some vs _.includes
Lodash _.some vs _.includes vs array.find
create temp object vs Object.fromEntries
create temp object vs Object.fromEntries #2
Stor info in Array vs Object
lodash _.some vs Array.some
string concat big string
Comments
Confirm delete:
Do you really want to delete benchmark?