Regex testing whitespace vs trim

one year ago
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Test name Executions per second
regex 6483915.5 Ops/sec
trim 12761210.0 Ops/sec
regex new init every time 9557902.0 Ops/sec
Script Preparation code:
Tests:
  • regex

  • trim

  • regex new init every time

Open this result on MeasureThat.net