parseFloat

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
parse with no px
var pcode = 'p'.charCodeAt(0);
var xcode = 'x'.charCodeAt(1);

for (var i = 0; i < 200; i++) {
  var s = i + "px";
  //if(s.charCodeAt(s.length-2) === pcode && s.charCodeAt(s.length-1) === xcode) 
  s = s.slice(0,-2);
  parseFloat(s);
}
ready
parse with px
for (var i = 0; i < 200; i++) {
  var s = i + "px";
  parseFloat(s);
}
ready

Revisions

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