Page 6 of 11
Re: BFTB - Wet Paint
Posted: 01 Dec 2009 22:29
by Squad Leader
The Baron wrote:Afraid not. Are you sure it's the reason your fan is going? Are you on about the CPU fan or a case fan?
not sure what fan it is but its bloody noisy
tried monkfish's tip and that stopped it but some of the features on the site wouldn't work then
....gonna have to get myself some earplugs

Re: BFTB - Wet Paint
Posted: 01 Dec 2009 22:34
by The Baron
The CPU fan is the one in the middle of your motherboard, attached to your processor. The case fans are on the sides of your PC case.
I've just removed all of the other javascript* from the rest of the site in favour of flash - what stopped working when you disabled Java, please?
* barring the Mutour map and homepage bookmarks feature.
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 01:06
by The Baron
Monkfish wrote:the code author acknowledges that it is cpu intensive
Only when using the addiitonal christmas lights.
http://www.schillmania.com/projects/snowstorm/
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 02:14
by Monkfish
Sorry, but it's heavy on the cpu in either case, albeit "notably lower" without the Christmas Lights.
I've tested it (without the lights) with Safari and Firefox. The former sees approx 70% cpu use and the latter around 100%, both cases with no other applications running. Move off the site or switch off the snow and the cpu usage drops down to a negligible level.
I'm not fluent in javascript, or in particular the nuances of its thread handling (my language is the close relative java) but having had a quick look I think the code might have a bit of busy waiting in it, meaning that the code loops when waiting to do other things, which makes it hungry for cpu cycles. I once had similar issues with an applet I embedded in a webpage, even when paused.
If you open Task Manager in Windows (or Activity Monitor in os-x) you can see the difference with and without the snow.
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 02:21
by The Baron
Strewth - you're right, my CPU usage leaps from 2% to 32%.
I'll start up a poll to see how many members are being affected by it.
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 02:27
by Chopper
Not half wrong, just watched Firefox jump up and down in task manager. It bounces back between 4% and 96%. I can also see java going up and down like a brides nightie, in between use mind you.
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 05:18
by Monkfish
Had a really good look at the javascript and, apart from spotting a couple of slight gains to be made by trimming some unneeded 'if' statements and perhaps using stacks to track active and inactive flakes I couldn't see a lot to do to.
Then I had a look again at the author's web page and he's slightly updated the code to use bulletpoints for snowflakes instead of image files - and this significantly reduces the cpu load - more than halves it using Safari on my laptop. Saves hosting the snow image file too. Version 1.4.20091115.
Oh, and you can muck around with this.snowColor too if you want... (try going from fff to d00)
Might be worth a look.
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 05:27
by The Baron
I'll give it a go.
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 05:32
by The Baron
Any better?
Re: BFTB - Wet Paint
Posted: 02 Dec 2009 05:50
by Monkfish
Yes, although there is a compounding effect when it runs on a forum page.
When I run the script at
http://www.bloodforthebaron.com/snow/sc ... owstorm.js in a simple blank page with black background I get CPU usage around the 30% mark. A forum page comes closer to 50% average - it's come down from the 70% seen before, but it could be that the browser's need to re-draw pixels on the page where the snow has been is having an effect (which I think is out of the author's control).
Altering the maximum number of flakes and active flakes might help (but there's a payoff in appearance) but beyond that I'm unfortunately stuck - sorry.