Clearly, global overhead of assertions depends on number and type of
invariants that you check.
My experience was simliar to Paul's. Compililng/disabling the assertions
away helps a great deal in many cases.
Paul ! I've started using pjstadig.assertions and it works like a charm :)
**Thank
Paul Stadig p...@stadig.name writes:
I think that you are worried about the overhead unnecessarily, though.
The assert status is checked at macro expansion time. If per module
switching on and off is what then I would suggest that you build on top
of the existing assert.
There is a huge
lop...@gmail.com writes:
Phillip, Paul - thanks a lot for you suggestions!
Phillip - I will definitely give your trick a try.
Right now, without experimenting, I see two shortcomings. First, as Paul
mentioned, checking assertion status via call to Java function will
introduce performance
On Mon, Oct 14, 2013 at 5:59 AM, Phillip Lord
phillip.l...@newcastle.ac.ukwrote:
lop...@gmail.com writes:
Same trick as
Java -- optimise the check away at compile time.
Indeed, this is how Clojure's assert works.
This is the way Clojure's assert works (by compiling away the assertion).
So it turns out it is possible to have runtime disabled assertions in
Clojure without a compiler change, but I don think it is possible to have
assertions that can be disabled per package without a compiler change (if
at all).
I have released a new library that allows you to globally
lop...@gmail.com writes:
Is it possible to use Java assertion system in Clojure?
I want to put invariant checks in my code which can be turned on/off at
runtime with java -ea/-da.
http://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html
The only mention touching this
The problem is that you would still have a performance hit. As I
understand, the reason that Java assertions have no runtime penalty when
disabled is because they depend on the value of a final field in a class
which the JIT will eliminate as dead code when that final field is set to
false.
As reflected in the linked discussion and Jira ticket, it seems possible to
be able to use -ea/-da with Clojure. It would definitely require a compiler
change, and I'm not aware of any further movement to make Clojure's asserts
use a mechanism compatible with -ea/-da.
An additional annoyance
Phillip, Paul - thanks a lot for you suggestions!
Phillip - I will definitely give your trick a try.
Right now, without experimenting, I see two shortcomings. First, as Paul
mentioned, checking assertion status via call to Java function will
introduce performance penalty, whereas the use of
Dear All,
Is it possible to use Java assertion system in Clojure?
I want to put invariant checks in my code which can be turned on/off at
runtime with java -ea/-da.
http://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html
The only mention touching this issue in Clojure I
10 matches
Mail list logo