[Cython] Size of output

Robert Bradshaw robertwb at gmail.com
Sun Feb 2 02:19:19 EST 2020


On Sat, Feb 1, 2020 at 6:33 AM John Skaller2 <skaller at internode.on.net> wrote:
>
> > given target. Removing the final 0.5% of code that is "unused in some
> > cases" is really not something I would want to invest days into, each time
> > we make a change in Cython.
>
> But its not 0.5%. My problem is trying to read the generated code.
>
> A possibility might be an option which puts the boilerplate in one file
> and the variant code in another that then #includes the boilerplate.
> So the code is the same, but the main file is much easier to inspect
> to see what got generated.

The primary target of the generated code is a C compiler, though we do
try to generate code that's reasonably comprehensible for a human as
well. However, there's often a tradeoff to be made in terms of
conciseness and readability of the generated C code and that of the
Cython codebase itself, and the latter is arguably more important.

Also, as mentioned earlier, the generated code also makes heavy use of
macros (including much of the refnanny stuff) so that various
decisions can be deferred to C compile time.

I'm also sure there's room for improvement, but that might not be the
highest priority for where to spend limited time. Hopefully the -a
option is useful.

- Robert


More information about the cython-devel mailing list