[Cython] CEP1000: Native dispatch through callables

Robert Bradshaw robertwb at gmail.com
Sun Apr 15 08:07:13 CEST 2012


On Sat, Apr 14, 2012 at 5:28 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Robert Bradshaw wrote:
>
>> Has anyone done any experiments/timings to see if having constants vs.
>> globals even matters?
>
>
> My gut feeling is that one extra memory read is going to be
> insignificant compared to the time taken by the call itself
> and whatever it does.

This is most valuable for really fast calls (e.g. a user-defined
double -> double), and compilers (and processors) have evolved to a
point that they're often surprising and difficult to reason about.

> But of course gut feelings are always
> better when backed up (or refuted!) by measurements.

I agree with your gut feeling (where insignificant to me is <3%) but
can't rule it out, and data trumps consensus :).

> This is an aside, but is it really necessary to define the
> signature syntax in a way that involves unmatched parens?
> Some editors (such as the one I like to use) get confused
> by this, even when they're inside quotes.
>
> The answer "get a better editor" would be entirely
> appropriate if there were some advantage to this syntax,
> over a non-unbalanced one, but I can't see any.

Brevity, especially if the signature is inlined. (Encoding could take
care of this by, e.g. ignoring the redundant opening, or we could just
write di=d.)

- Robert


More information about the cython-devel mailing list