[Cython] Improving compile times for Cython extensions with C sources

Wes McKinney wesmckinn at gmail.com
Tue Sep 17 21:09:06 CEST 2013


On Mon, Sep 16, 2013 at 1:12 PM, Robert Bradshaw <robertwb at gmail.com> wrote:
>
> On Mon, Sep 16, 2013 at 11:48 AM, Wes McKinney <wesmckinn at gmail.com> wrote:
> > I haven't been able to find an easy answer to this question, but here is my
> > problem:
> >
> > Cython file: extension.pyx
> > Declarations / C imports: extension.pxd
> > C dependencies:
> > a.c
> > b.c
> > c.c
> >
> > These are all compiled together to produce extension.so.
> >
> > The problem is, when I modify extension.pyx, all 4 C files are recompiled,
> > even if the 3 straight C files are untouched.
> >
> > Any way to fix the build system to not do this? Seems that the .o files from
> > the C dependencies could be easily reused.
>
> Cython compiles the .pyx file to a .c file; distutils takes over from
> there. I'm not aware of any way to do this (short of making a+b+c into
> a shared library) but perhaps someone on the distutils lists would
> have some ideas.
>
> You could also look at using ccache.
>
> - Robert
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel


Using ccache and patching distutils as described in this SO post was
adequate for my needs:

http://stackoverflow.com/questions/11013851/speeding-up-build-process-with-distutils

thanks!


More information about the cython-devel mailing list