[Python-Dev] Using argument clinic to replace timemodule.c:parse_time_t_args()

Nikolaus Rath Nikolaus at rath.org
Sun Jan 19 22:03:14 CET 2014

Larry Hastings <larry at hastings.org> writes:
> On 01/18/2014 09:52 PM, Ryan Smith-Roberts wrote:
>> I still advise you not to use this solution. time() is a system call
>> on many operating systems, and so it can be a heavier operation than
>> you'd think. Best to avoid it unless it's needed (on FreeBSD it
>> seems to add about 15% overhead to localtime(), for instance).
> I agree.  Converting to Argument Clinic should not cause a performance
> regression.  Please don't add new calls to time() for the sake of
> making code more generic.

I don't see how the conversion would result in more calls to time() than
we have now. It seems to me that the expression for the C default should
be only evaluated if the caller did not specify a value. Is that not how
ac works?

> A better choice would be to write a converter function in C, then use
> a custom converter that called it.  Nikolaus: Is that something you're
> comfortable doing?

As long as you're comfortable looking over the (probably buggy) patch,
yes, I'm happy to give it a shot.


Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

             »Time flies like an arrow, fruit flies like a Banana.«

More information about the Python-Dev mailing list