Skip to content

Commit a816bd4

Browse files
committed
BLD Keep debug builds optimized
Without optimizations, testing went up from ~2mins to ~10mins
1 parent c2a9ac6 commit a816bd4

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
PIP_EDITABLE = python -m pip install --editable . --no-deps --no-build-isolation
22

33
debug: mahotas/*.cpp mahotas/*.h mahotas/*.hpp
4-
$(PIP_EDITABLE) --config-settings=build-dir=build/debug --config-settings=setup-args=-Dbuildtype=debug --config-settings=setup-args=-Dglibcpp_debug=true
4+
$(PIP_EDITABLE) --config-settings=build-dir=build/debug --config-settings=setup-args=-Dbuildtype=release --config-settings=setup-args=-Db_ndebug=false --config-settings=setup-args=-Dglibcpp_debug=true
55

66
debug3: mahotas/*.cpp mahotas/*.h mahotas/*.hpp
7-
python3 -m pip install --editable . --no-deps --no-build-isolation --config-settings=build-dir=build/debug --config-settings=setup-args=-Dbuildtype=debug --config-settings=setup-args=-Dglibcpp_debug=true
7+
python3 -m pip install --editable . --no-deps --no-build-isolation --config-settings=build-dir=build/debug --config-settings=setup-args=-Dbuildtype=release --config-settings=setup-args=-Db_ndebug=false --config-settings=setup-args=-Dglibcpp_debug=true
88

99
fast: mahotas/*.cpp mahotas/*.h mahotas/*.hpp
1010
$(PIP_EDITABLE) --config-settings=build-dir=build/fast --config-settings=setup-args=-Dbuildtype=release

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ Development happens on github
193193
([https://github.com/luispedro/mahotas](https://github.com/luispedro/mahotas)).
194194

195195
The `Makefile` that is shipped with the source of mahotas can be useful
196-
too. `make debug` rebuilds the editable install with a Meson debug build and
197-
enables `_GLIBCXX_DEBUG`. `make fast` rebuilds it in release mode. `make tests`
198-
runs the test suite after a debug rebuild.
196+
too. `make debug` rebuilds the editable install in optimized mode while keeping
197+
assertions enabled and adding `_GLIBCXX_DEBUG`. `make fast` rebuilds it in
198+
plain release mode. `make tests` runs the test suite after a debug rebuild.
199199

200200
```bash
201201
make debug
@@ -208,12 +208,13 @@ If you want the equivalent of the old `DEBUG=1` build without
208208
```bash
209209
python -m pip install -e . --no-deps --no-build-isolation \
210210
--config-settings=build-dir=build/debug \
211-
--config-settings=setup-args=-Dbuildtype=debug
211+
--config-settings=setup-args=-Dbuildtype=release \
212+
--config-settings=setup-args=-Db_ndebug=false
212213
```
213214

214215
Be careful not to use the debug build in production unless you are chasing a
215-
bug. The `_GLIBCXX_DEBUG` configuration used by `make debug` is very slow as it
216-
adds many runtime checks.
216+
bug. The `_GLIBCXX_DEBUG` configuration used by `make debug` can still be much
217+
slower than a plain release build because it adds many runtime checks.
217218

218219
## Links & Contacts
219220

docs/source/contributing.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ of runtime checks.
2323

2424
There are two levels:
2525

26-
1. A Meson ``debug`` build turns on assertions. The code will run slower, but
26+
1. A release build with ``b_ndebug=false`` turns on assertions. The code will run slower, but
2727
probably not noticeably slower, except for very large images.
28-
2. ``make debug`` uses a Meson ``debug`` build and additionally defines
29-
``_GLIBCXX_DEBUG``. This only has an effect with libstdc++, but when
30-
available it enables checked iterators in the C++ standard library. The
31-
result will be code that runs **much slower** as many iterator operations
32-
are now checked. However, it catches many errors.
28+
2. ``make debug`` uses an optimized release build with assertions enabled and
29+
additionally defines ``_GLIBCXX_DEBUG``. This only has an effect with
30+
libstdc++, but when available it enables checked iterators in the C++
31+
standard library. The result can still be **much slower** as many iterator
32+
operations are now checked. However, it catches many errors.
3333

3434
The Makefile that comes with the source helps you::
3535

docs/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ source. For a normal install, use::
4949

5050
For a debug-style editable install, use::
5151

52-
python -m pip install -e . --no-deps --no-build-isolation --config-settings=build-dir=build/debug --config-settings=setup-args=-Dbuildtype=debug
52+
python -m pip install -e . --no-deps --no-build-isolation --config-settings=build-dir=build/debug --config-settings=setup-args=-Dbuildtype=release --config-settings=setup-args=-Db_ndebug=false
5353

5454

5555
Bleeding Edge (Development)

0 commit comments

Comments
 (0)