From: Dante Mavec (
Date: 06/19/02

While poking around class.c I found a comment that implied that a huge set of switches like this:

switch (GET_CLASS(ch))
case 0: return 90;
case 1: return 87;

etc etc etc is faster (processor-wise) than something like " return (100 - (GET_LEVEL(ch) * 1.5)) "

I'd be inclined to say that this isn't the case...  the second way of doing it is one calculation, whereas the latter could have to make 20 or so comparisions between GET_LEVEL(ch) and a number before finding the right value.

Firstly, does the second actually use more juice?
Secondly, if it does, is it an appreciable amount?

 - Dante

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT