Re: R: R: R: [AD] Allegro 5 new config routines, alpha 1

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Angelo Mottola wrote:
> One of the goals of the new config system was to avoid conversions at
> runtime, unless explicitely requested. That's why now each entry is
> stored in its real data type, i.e. a bool/int/hex is stored into the
> int "value" of the CONFIG_ENTRY struct, and a string is stored into
> the char * "string" of the same struct.

Why? This sounds like over-optimization to me. Hopefully nobody is going
to access config variables very often? (At least that seems to be the
case for all variables in my allegro.cfg.) If a config variable needs to
be re-used, I think the normal thing would be to save it in a program
variable anyway, right? It's going to take at least time proportional to
the length of the config variable name to compute the hash key anyway,
and converting a string to a number takes time proportional to the
length of the string representation of the number, so the slowdown will
probably be something like a factor of 2. IMHO, having the same file
format that most other programs, and a clean easy to use interface both
for the person who hacks config files and to the programmer is far more
important than speed in this case.

-- 
Sven Sandberg    svsa1977@xxxxxxxxxx    home.student.uu.se/svsa1977



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/