FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Suggestions
   Website, Reference, Example Suggestions
(Moderator: REAS)
   int versions of red(),green(),blue() and switch()
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: int versions of red(),green(),blue() and switch()  (Read 2485 times)
st33d

WWW Email
int versions of red(),green(),blue() and switch()
« on: Mar 23rd, 2005, 1:58am »

I recently queried the speed of calculating the functions in the title of this post.
 
http://processing.org/discourse/yabb/board_Syntax_action_displa_y_num_1111319577.html
 
I have revised an old applet which used to take up to 45 minutes to destroy an image. Switching the program to run on an int version and implementing a switch() doubled the speed of the program.
 
Since the change was so drastic I'm wondering if would be unreasonable to request switch() be mentioned in the reference along with if and else .switch() I read creates a table and uses less machine code than a string of ifs.
 
I also wonder if it's worth as a footnote to red(), green(), blue() or perhaps color to mention the faster method.
 
I didn't know about switch() for ages and the color things passed me by too. These could have saved me a world of time when I was trying to get work out quickly for an exhibit the other week at short notice.
 

I could murder a pint.
Pages: 1 

« Previous topic | Next topic »