View Single Post
  #72 (permalink)  
Old 12-23-2009, 02:14 AM
niteriderxp's Avatar
niteriderxp
PPCGeeks Regular
Offline
Location: Seattle, WA
 
Join Date: Apr 2007
Posts: 95
Reputation: 85
niteriderxp is becoming a great contributor
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: Turn off ppcgeeks snowflakes

Quote:
Originally Posted by lipidfats View Post
hahaha 99%???
i'm glad i went for the extra gig of RAM a few years ago...
How exactly do you expect extra memory to help a purely computational task.

Here is the script simplified:
1. Generate a whole bunch of random numbers
2. Multiply random numbers by resolution to obtain random pixel positions
3. Add the current pixel's y position to a randomly generated fall rate (makes snow go down)
4. Add the current pixel's x position to output of cosine function (makes snow sway)
5. Draw pixels
6. GOTO 3.

The only thing being stored here is the current pixel positions, everything is being calculated several times a second.

Though, why it slows things down probably has more to do with how inefficiently the browser retrieves/modifies html objects rather than the calculations.