API : constness ?

Benoît Dejean bnet at ifrance.com
Mon May 31 01:51:26 EDT 2004


Le Mon, 31 May 2004 11:56:57 +1000, Delaney, Timothy C (Timothy) a
écrit :

> Benoît Dejean wrote:

>> static const char * const kwlist[] = { "uri", "open_mode", "exclusive",
>> "perm", NULL };
> 
> Does this give any performance or size improvement?

of course, it avoids a lot of relocation, reduces load time, and manque
the compiler to make further informations because data will be in a
readonly segment. it is safe to apply this kind of change to static data.

> 
> If it will simplify calling code, I don't see any reason not to do it.
> However, there is a general policy of not doing large chunks of
> boilerplate fixing - instead it is encouraged to make these changes in
> code that is being actively worked on for some other reason. Small
> patches are good.
> 
> Perhaps you should choose a few cases that bug you the most (e.g.
> PyArg_ParseTupleAndKeywords) and submit a patch just for those.

you're right. i should first work on printf/scanf like functions

> Additionally, if you can show a performance improvement as a result (and
> importantly, no loss of performance on Windows ...) it's more likely to
> be reviewed kindly ... ;)

my first goal is const correctness, i don't know if i can show something.
it will just remove warnings and move data to the text segment, etc




More information about the Python-list mailing list