parseInt vs. replace(/px/,'')

Benchmark created on


Setup

var elmWidth = '345px';

Test runner

Ready to run.

Testing in
TestOps/sec
parseInt()
parseInt(elmWidth);
ready
replace(/px/,'')
elmWidth.replace(/px/,'');
ready

Revisions

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