Hi All,
Check this out:
While debugging my code I found out that the IE6 brouwser is 4.4x quicker!!!
Why is my question?
To check yourself: save the code in a html file and run it in different Browsers.
Cheers,
Bastiaan
8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<html><head>
<script language="JavaScript" type="text/javascript">
startTime= new Date();
function _DaysOfMonth(yy,mm){ // dateIn = yyyy,mm[,dd = optional]
if (mm>10) mm = 0;
else mm++;
d = new Date(yy,mm,01);
d.setDate(d.getDate()-1);
return (d.getDate());
}
function _daysOfMonth(yy,mm) //mm=0..11, yy is optional
{ DOM=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if ((mm==1)&&(yy)&&(yy%4==0)) return(29);
return(DOM[mm]);
}
var avCh1= 0;
var avCh2= 0;
for (i=0; i<10000; i++){
var timer = new Date();
var days1 = _DaysOfMonth(04,11);
var check1 = (new Date()-timer);
var timer = new Date();
var days2 = _daysOfMonth(04,11);
var check2 = (new Date()-timer);
avCh1+=check1;
avCh2+=check2;
}
endTime= (new Date()-startTime);
document.write("1st function in:"+(avCh1/10000)+"ms - days:"+days1+"<p>");
document.write("2st function in:"+(avCh2/10000)+"ms - days:"+days2+"<p>");
document.write("Total time it took:"+endTime/1000+"sec.<p>");
</script>
</head><body></body></html>
8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IE6 quicker than FireFox!!
-
- Guest
-
- Guest
-
- Posts: 0
- Joined: December 31st, 1969, 5:00 pm
Aww, IE takes 1/45000 of a second to create a custom Date object, and Mozilla takes 1/3300 of a second to do the same. Is this really an issue?
BTW, your test code has way too much overhead and doesn't take into account that (new Date()) has a granularity of 50-70ms. Here's how to get a true average (divide by 10000 afterwards):
BTW, your test code has way too much overhead and doesn't take into account that (new Date()) has a granularity of 50-70ms. Here's how to get a true average (divide by 10000 afterwards):
Code: Select all
var avCh1 = 0;
var avCh2 = 0;
var timer, days1, days2, i;
timer = new Date();
for (i=0; i < 10000; i++) {
days1 = _DaysOfMonth(04,11);
}
avCh1 = (new Date() - timer);
timer = new Date();
for (i=0; i < 10000; i++) {
days2 = _daysOfMonth(04,11);
}
avCh2 = (new Date() - timer);
-
- Posts: 831
- Joined: November 18th, 2003, 2:25 pm
-
- Guest
-
- Posts: 19
- Joined: February 10th, 2004, 7:42 am
Look ... the test of tests.... I depend on this as fact...
MY WIFE ! ! The I know nothing about pcs just make my emails and searches work queen.
She used 7.0 the other night by accident. I left it open on our home pc (Cel 400 512ram) by mistake. I came in the next day and she was using it. I asked why. Her first response was ..... " Its so much faster than explorer ! ! "... I installed 8 yesterday and out of curiosity I asked her if she noticed anything different. She said "I think its even faster then yesterday.. what did you do... ??"
Now thats a test if I ever saw one. Nevermind CODE.. just find a user who doesnt know or cares how a pc runs... If they notice then its BIG... You think that the millions of IE users know why it runs??
MY WIFE ! ! The I know nothing about pcs just make my emails and searches work queen.
She used 7.0 the other night by accident. I left it open on our home pc (Cel 400 512ram) by mistake. I came in the next day and she was using it. I asked why. Her first response was ..... " Its so much faster than explorer ! ! "... I installed 8 yesterday and out of curiosity I asked her if she noticed anything different. She said "I think its even faster then yesterday.. what did you do... ??"
Now thats a test if I ever saw one. Nevermind CODE.. just find a user who doesnt know or cares how a pc runs... If they notice then its BIG... You think that the millions of IE users know why it runs??