parseFloat vs replace

Benchmark created on


Description

Setup

const transitionDuration = '0.5s, 1s';

Test runner

Ready to run.

Testing in
TestOps/sec
replace
let duration = transitionDuration.replace(/,.*/, '').replace('s', '') * 1000;
ready
parseFloat
let duration = parseFloat(transitionDuration) * 1000;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.