>
> --- "Chris \"Winston\" Litchfield" <[EMAIL PROTECTED]> wrote:
> > Wow..  a simple thing turns into a boost of information.
>
> [snip]
> > > 3. single points of information (variable istead of multiple function
calls)
>
> This is ok, so long as you properly type them. For example, in your
previous
> performance tip you said to use an int. A const int, or better still a
const
> size_t, is actually going to work much better.
>
> > small or not, its still an improvement..

If you have a compiler that supports it.  Afraid that some of the C
compilers I compile on dont support const's.


>
> Yes, but these will only give you a very small performance boost. Almost
> negligable. And the time it takes to convert all your code as you suggest
is
> not really worth the effort IMO.

Alas, your debug comment is true but here you say its not worth it.. I
contend there is also a
debug gain as well :)


>
> If you need to optimize, you should run the code through a profiler. Then
when
> you have a report telling you that most of your CPU time is spent in
> update_handler or something, you take a look at what the code is doing and
try
> to make it more efficient.
>
> I.E. Stop having it loop through every character_data in the game to see
who is
> fighting, or which mobs need to move this tick, etc. Create lists of these
> character_data instances instead, to prevent looping over unimportant
data. Or
> create an event queue and store the fight and move events in there
specifically
> when something needs to fight or move. Then only search through those
events ,
> using an optimized search method, to find what you need to do. That sort
of
> thing will give you HUGE performance gains.
>
>

Most of the ones you speak about are already covered in various snippets out
there.

 I am down to some SMALL changes now for performance gains.
My footprint of my mud is base 42 meg of memory.  14 second boot time, etc
and all that. When I hit an area of code I am looking at for various reasons
I tend to optimize as well.  fread_string is something I did not expect to
have look at.. but I do :(

For those interested there are a couple major snippets for performance been
floating around:
player_list is one (very very useful)
aggro_update() increase in speed by changing order of search

I also love the canary style alloc_mem and free_mem.. they really improved
some memory issues.

Chris "Winston" Litchfield
The Mage's Lair (www.mageslair.net)





Reply via email to