Re: Class.c

From: George Greer (greerga@circlemud.org)
Date: 06/20/02


On Wed, 19 Jun 2002, Daniel A. Koepke wrote:

>On Thu, 20 Jun 2002, Dante Mavec wrote:
>
>> Firstly, does the second actually use more juice?
>
>Yes, the switch statement is faster.

The 'switch' version is slower, but ...

>> Secondly, if it does, is it an appreciable amount?
>
>No.  There will not be any noticeable difference between the performance
>of the two versions.

what Daniel says here is correct.  You'll never notice it in practice.

  100,000 loops for saving throws.
1,000,000 loops for THAC0 and experience.
-----------------------------------------
switch: Saving throws: 22.446296 seconds.
equatn: Saving throws:  1.887142 seconds.
table : Saving throws:  1.514616 seconds.
switch: THAC0: 32.097520 seconds.
equatn: THAC0:  3.241892 seconds.
table : THAC0:  1.234327 seconds.
switch: Experience: 37.086464 seconds.
equatn: Experience:  4.238704 seconds.
table : Experience:  1.304827 seconds.

        NOTE:   'table' is "best case" because of the way my trivial
                benchmark ran the loops. The worst case is equal to or
                slower than the silly equations I made up.

So .00022446 seconds per switch saving throw.  You save a whole .00020559
seconds by using an equation over the switch.  The only place you ever
might get a (minuscule) measurable difference is the "levels" command.

I'd use an equation if we had one with a perfect regression.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



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