Ant's
Ant's

Reputation: 13811

Assertions in Groovy?

as i know assertions are been used to assert any value. But if i add, large number of assertion code to my project, it that affect my performance?

Upvotes: 1

Views: 1593

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123996

Yes, assertions do affect performance. Depending on the application, it might or might not matter. Anyway, assertions are primarily meant for cases where the performance overhead doesn't matter (tests, scripting). And if you add a custom message (assert x > 10, "x should be greater than 10"), the overhead will be smaller because the assertion's values won't be recorded.

Upvotes: 1

Related Questions