Ticket #249 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

build overhead

Reported by: nicdumz Owned by: somebody
Priority: minor Milestone: 0.13
Component: Build System Keywords:
Cc: nicdumz@…

Description

python setup.py build --no-cython-compile
python setup.py build --no-cython-compile

Works as expected. The module is built only once

But

python setup.py build
python setup.py build

Builds twice all the C-extensions, and compiles twice the generated .c

1) all C-extensions are being compiled using the python-only compiler before calling setup() 2) Because of #1, at every use of setup.py, new .c files are generated 3) An because those .c are new, build_ext will call at each run a C compiler on those .c

That's a lot of unnecessary overhead! It is also problematic for users that build and install separately, doing the latter operation as root.

Attachments

t249.patch Download (5.0 KB) - added by nicdumz 4 years ago.

Change History

Changed 4 years ago by nicdumz

Changed 4 years ago by nicdumz

And the proposed patch :)

To avoid step 1, I added a changedate check of all cython sources against each generated .c : the .c are generated only if needed.

And because distutils checks by itself the timestamp of the extension sources before building them, .c files are now only compiled when needed.

build && build: now only builds once.

build, remove a .so, build: works properly, only the missing .so is recreated

build, remove a .c, build: works properly, only the missing .c is generated from cython source

build, touch a cython file, build: works properly, everything is rebuilt.

=)

Changed 4 years ago by nicdumz

  • cc nicdumz@… added

Changed 3 years ago by scoder

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from wishlist to 0.13

Don't remember when this was fixed, but it definitely works for me now.

Note: See TracTickets for help on using tickets.