slice vs substring trim end (v6)

Revision 6 of this benchmark created on


Setup

var str = '100px'

Test runner

Ready to run.

Testing in
TestOps/sec
substring
ret = str.substring(0, str.length - 2) / 100;
ready
slice
ret = str.slice(0,-2) / 100;
ready
parseFloat
ret = parseFloat(str) /100;
ready

Revisions

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