parseInt vs replace vs split (v3)

Revision 3 of this benchmark created by john on


Description

what is faster

var size = "100px";

parseInt(size, 10); +size.replace('px',''); +size.split('p')[0];

Test runner

Ready to run.

Testing in
TestOps/sec
parseInt
size = "100px";
parseInt(size, 10);
ready
replace
size = "100px"; + size.replace('px', '');
ready
split
size = "100px"; + size.split('p')[0];
ready

Revisions

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