octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

assert() taking long time


From: Daniel Kraft
Subject: assert() taking long time
Date: Thu, 19 Sep 2013 09:35:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8

Hi,

I like to use the assert() function liberally in my codes, since this
helps me spot bugs early.  However, I frequently discover by profiling
that assert takes up a good chunk of the runtime of my programs.  Are
there any ideas why this is the case and if it could be optimised to
speed assert() up?

If this is not possible, it's not a big deal either--assert is meant for
debugging, and when I am confident that the code works, it is no problem
to just disable the asserts during production runs (with larger
parameters, for instance).

In C/C++, one can easily disable assertions using the preprocessor.  I
think it would be great if Octave could provide a similar feature, where
asserts could be executed or ignored depending on a switch similar to
debug_on_error and all those options.  Is this feasible?  One could even
go further and try to only disable asserts in tight loops, for instance
by ignoring a specific assert line for the next 10,000 calls if it was
already executed 100 times, or something like that.  (With another
configuration option.)

What do you think about this idea?  If it seems to be doable easily and
is deemed useful to have, I'll volunteer to work on a patch.

Yours,
Daniel

-- 
http://www.domob.eu/
--
Done:  Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Mon-Pri


reply via email to

[Prev in Thread] Current Thread [Next in Thread]