Debug vs Release build

24 views
Skip to first unread message

Anders Wallin

unread,
Sep 15, 2011, 8:25:36 AM9/15/11
to opencamlib
Hi all,

While benchmarking my voronoi-diagram code [2] I realized how much of
a difference compiling with "-O3" and turning off assert()s makes to
the runtime.

I've now modified the CMakeLists.txt for opencamlib to include a new
option BUILD_TYPE which defaults to ON, sets CMAKE_BUILD_TYPE to
"Release", and builds opencamlib with optimizations and without
asserts.

An example script [1] runs in 16.3s with a Debug build and in 5.2s
(about 3x faster!) when the build type is Release.
In the build-directory I run "cmake -i ../src" to interactively set
the options defined in the cmakelists.txt file. The build type is now
Release by default, but it may be instructive to do a Debug build when
hunting for bugs or developing new/untested additions.

If other parts of the heekscnc toolchain are similarly built with
cmake, then there might be a "free" 3x speedup available by setting
CMAKE_BUILD_TYPE.

Anders

[1] https://github.com/aewallin/opencamlib/blob/master/scripts/batchdropcutter_with_linefilter_test_1.py
[2] https://github.com/aewallin/openvoronoi

Reply all
Reply to author
Forward
0 new messages