Its not my query.  He did ask about performance specifically.

ROM is chock full of global variables.  In essense I consider global
variables a "Data base" and try and keep active things local to the
proceedures.

Take damage..  passing ch though to raw_kill.  I added an active_flags set
on the char to identify what operation was happening.  This cleaned up
plenty of slight bugs.

Chris


----- Original Message ----- 
From: "Chad Simmons" <[EMAIL PROTECTED]>
To: "Chris Winston Litchfield" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Tuesday, August 19, 2003 3:29 AM
Subject: Re: Question (of course)


>
> --- "Chris \"Winston\" Litchfield" <[EMAIL PROTECTED]> wrote:
> > Macros using global memory?
> >
> > Pass pointers or use globals for performance.
>
> I'm not sure I understood you're initial query, but I'm concerned about
the
> above statement.
>
> This is not the first time you've suggested that good programming practice
> (readability, and maintainability) be given a back seat to _highly_
miniscule
> performance gains. There are reasons for using pointers, and there are
reasons
> for using globals. IMO "performance" is not a primary reason for doing
either.
>
> Admittedly, in a number of places pointers can be employed to give
significant
> performance increases, but this is usually the result of using pointers to
> create efficient data structures which provide performance gains. Using
> pointers in and of themselves won't really do this.
>
> Globals should be used sparingly at best. They reduce the flexibility of
your
> programming design, and in many cases make sections of code highly
dificult to
> read. I'm reminded of some of that terrible terrible source I saw of
Medevia
> (sp?). Where to change the color text being sent to the character, a macro
> would be called. This macro would in turn change a global variable to a
> different color code. Then when the text was written to a character, it
would
> insert the code in this variable... The problem was that if one person had
the
> color output to them, and the programmer forgot to switch back, all the
other
> characters would also start getting their messages in that color.
Variables in
> the global scope should be restricted to only those things which have no
> alternatives but to be accessed at the global level. IMO data about one
> specific character attacking another does not fall into this paradigm.
>
>
> ~Kender
>
> Rules of Optimization:
> Rule 1: Don't do it.
> Rule 2 (for experts only): Don't do it yet.
> - M.A. Jackson
>
> "More computing sins are committed in the name of efficiency (without
> necessarily achieving it) than for any other single reason - including
blind
> stupidity."
> - W.A. Wulf
>
> "We should forget about small efficiencies, say about 97% of the time:
> premature optimization is the root of all evil."
> - Donald Knuth
>
> =====
> -----BEGIN GEEK CODE BLOCK-----
> Version 3.1
> GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$
> P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O
> M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@
> b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
> ------END GEEK CODE BLOCK------
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> -- 
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
>



Reply via email to