Curious whether there was any difference between
var p = parseInt(t/1000);
and
var p = Math.floor(t/1000);
I did this:
start = new Date().getTime(); for ( var i=0; i<1000000; i++) parseInt(start/1000); new Date().getTime() - start;
And
start = new Date().getTime(); for ( var i=0; i<1000000; i++) Math.floor(start/1000); new Date().getTime() - start;
In Chromium parseInt
would take about 7.2 seconds against Math.floor
6.6 on my netbook.
Firefox complained about the script taking to long. It could only do 200000 operations in about the same time.
So I guess this is very implementation dependent.