Script Preparation code:
Tests:

Historical Performance Data aggregated from 49 community runs

Desktop Results:
Chrome 42 runs
trim
17.7M/s
regex
2.7M/s

Fastest: trim (6.7x faster)

View exact numbers
  • trim: 17,697,310 ops/sec
  • regex: 2,652,196 ops/sec
Firefox 7 runs
trim
1804.3M/s
regex
3.3M/s

Fastest: trim (543.4x faster)

View exact numbers
  • trim: 1,804,274,944 ops/sec
  • regex: 3,320,475 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    regex
    trim

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0
Firefox 152 on Windows
View result in a separate tab
trim
2841.8M/s
regex
5.0M/s
View exact numbers
Test name Executions per second
trim 2,841,813,248 Ops/sec
regex 4,981,438 Ops/sec