neerolyte wrote:
[color=blue]
> although this is a rather poorly programmed script, Netscape is to blame.
>[/color]
In part, this is true. Mozilla-based browsers are struggling with very
demanding animation DHMTL scripts. This is exactly the case here:
Bug 64516: 95-99% CPU usage for dhtml "snow effect"
http://bugzilla.mozilla.org/show_bug.cgi?id=64516
Bug 186442: "snowfall" script causes browser to slow to a crawl
http://bugzilla.mozilla.org/show_bug.cgi?id=186442
[color=blue]
> I have only looked at it in MSIE 6 and Mozilla Firebird 0.7, and experianced
> similar issues, it seems that MSIE has a much cleaner way of drawing the
> webpages, which means that when something is being drawn over and over it
> slows the computer down much more.
>[/color]
Yep!
[color=blue]
> Here is the easiest solution I can come up with:
> change this line:
> runspeed=40; //setTimeout speed!
>
> to something like this:
> runspeed=navigator.appName == "Microsoft Internet Explorer"?40:500;[/color]
This is not the best way to detect browsers. Anyway, I think the main
issue is the setTimeout value. I still don't recommend anything under
64msec or even 128msec for such page. The original poster has a 3Ghz
cpu: that,s not the case for many users.
[color=blue]
> //setTimeout speed!
>[/color]
Correct again! There are a lot of badly coded scripts out there in
Cut-N-Paste javascript sites which mindlessly have scripts resorting to
insane setTimeout values demanding insane cpu, video and memory resources.
[color=blue]
>
>
> This is not a great solution as it makes the snow jumpy on non MSIE
> browsers, but it will save your CPU and stop the mouse jumping
>[/color]
It is a better solution than you may think. setTimeout values (in
particular in recursive calls and intense DHTML animations) should never
be faster than 64 msec. for demanding scripts. Even MSDN says so too.
"Code optimization:
setTimeout
Speaking of animation, one of the most common techniques for animating
elements is to use a timer with window.setTimeout to position an element
on the page incrementally. A quick tip: Use as few timers as possible.
Timers consume valuable system resources, and the behavior of multiple
timers, all working together, will greatly vary on differently powered
machines. A way to animate multiple elements, while minimizing timer
use, is to employ a single main loop, powered with a single
window.setTimeout() call. In that single loop, keep a list of all
elements you need to manipulate. Loop through that list with each tick,
and perform your required move."
Michael Wallent
Microsoft Corporation
http://msdn.microsoft.com/library/de...l/dude1201.asp
DU
[color=blue]
> "Jonny" <jonny_xyz_75@yahoo.co.uk> wrote in message
> news:f42fc7f9.0401051917.22ee62c8@posting.google.c om...
>[color=green]
>>Netscape 7.02 is giving me a headache with a downloaded snow script.
>>Starting with a blank page, I inserted the script and checked it in IE
>>6 and Netscape 7.02. Everything worked and looked fine. A check on CPU
>>usage (Windows Task Manager>Performance) gave a 0% to 2% reading for
>>both browsers on a Pentium 4, 3.06GHz running XP.
>>
>>As I added text, images, tiled background and so on. I noticed the
>>mouse was becoming jerky in Netscape 7. Another CPU usage check now
>>gave a 98% peak reading for N7 but still 2% in IE??
>>
>>I removed the tiled background jpg, which brought it down to 33%. Then
>>removed the text and images, now a blank page again except for the
>>script, which returned it to 0% to 2%!
>>
>>Is there a problem with this script or is it down to Netscape 7? I've
>>used loads of animation scripts before in trusty old Netscape 4 and
>>never had any problems like this - I've not long upgraded to 7.
>>
>>Anyway, the script I'm using is from
>>
http://www.btinternet.com/~kurt.grig...t/SnowImg.html
>>Is it duff and if so where can I find another? The page is for my
>>9-year-old daughter, she really wants a snow theme and Daddies looking
>>a bit dim at the moment.
>>
>>Thanks for any help,
>>Jonny.[/color]
>
>
>[/color]