[Developers] Double quotes around keyword parameter values
Jonathan Thornburg
jthorn at aei.mpg.de
Sun May 29 09:54:32 CDT 2005
Erik Schnetter:
> I would rather go the other
> way, namely specifying that keywords must consist of first an
> alphabetic, and then alphanumeric characters. This way, keywords
> are like identifiers in computer languages.
Ick. I don't like this at all.
Jian Tao wrote:
| So you mean a parameter like the following will be invalid in the
| future ? ADMBase::lapse_evolution_method = 1+log
I too would like to keep the existing semantics of keyword parameters,
including the "arbitrary nonempty strings" part.
Erik Schnetter:
> Currently, keyword parameters are handled very inefficiently in Cactus.
> Checking a keyword parameter is an operation that takes probably
> thousands or tens of thousands of instructions, which makes it
> impossible to check them inside an inner loop. (Essentially, comparing
> keyword parameters in Fortran requires calls to malloc and a case
> insensitive string comparison.)
It would be interesting to see some actual profile data on this.
Modern malloc() libraries (eg the glibc/Doug Lea malloc() described in
http://g.oswego.edu/dl/html/malloc.html
typically run under 30 instructions executed per allocation, with free()
under 20. And strcasecmp()'s inner loop in
http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/string/strcasestr.c?rev=1.1&content-type=text/plain&only_with_tag=HEAD
is only a few instructions per character.
If we're really burning 'thousands or tens of thousands of instructions',
maybe we want to take a closer look at what we're doing which is pessimizing
things so badly.
That said... If keyword parameter checks really are a performance
problem, why not just pre-decode them outside the inner loop?
> There are several possibilities for making this more efficient. The
> ones I could think of turn keyword parameters and their allowed values
> into C and Fortran identifiers (or macros or somesuch). Thus it would
> be necessary to restrict the allowed names to those that are allowed as
> identifiers.
If you want to do this, please don't replace the existing concept of
"keyword parameters" with this thing. Rather, please call it something
else (maybe "identifier parameters"), and *add* it to Cactus, keeping
the existing parameter types unchanged.
ciao,
--
-- Jonathan Thornburg <jthorn at aei.mpg.de>
Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
Golm, Germany, "Old Europe" http://www.aei.mpg.de/~jthorn/home.html
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
More information about the Developers
mailing list