[Cython] Exception check optimization

Nikita Nemkin nikita at nemkin.ru
Sun May 26 19:04:05 CEST 2013


Hi,

I wonder why is __pyx_filename (in exception check blocks)
tracked dynamically? AFAIK it's impossible to split function
body between multiple files (include only works at the top level),
which makes filename a compile time constant for any given function.

If the above is correct, __pyx_filename variable can be eliminated,
saving at least 5 bytes per exception check (more on x64).


On a related note, why is c_lineno enabled by default? So far I
have only found one pretty rare case when it is useful - debugging
autogenerated code in module init.
I suspect that most people don't bother turning it off and get
suboptimal code.


Best regards,
Nikita Nemkin


More information about the cython-devel mailing list