[hibernate-dev] Fail fast feature for Hibernate Validator
Emmanuel Bernard
emmanuel at hibernate.org
Mon Oct 4 13:07:55 EDT 2010
That or slowish validations.
One typical use case is that:
if ( validator.validate(customer, StraightToValidationScreen.class).size() >0 ) {
//manual process
}
else {
//automatic process
}
BTW, I've committed a non scientific perf test that shows an average of 5x perf improvement on an object graph of 5 object (one master and 4 children) and 4 constraints on A and 3 on B. Around 22ms vs 120 ms. (log4j logs set to ERROR). The perf change is visible even on smallish graphs.
It can be worthwhile.
On 4 oct. 2010, at 16:20, Hardy Ferentschik wrote:
> What would be the usecase? Saving time in large object graphs where I am only interested in whether there is a
> failure at all? You really need LARGE object graphs to make this worth while.
>
>
> On Mon, 04 Oct 2010 15:45:34 +0200, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
>
>> http://github.com/emmanuelbernard/hibernate-validator/commits/failFast
>>
>> What do you guys think?
>>
>> The idea is to stop a the first failure.
>> You can enable that :
>> - by property
>> - at config time
>> - when the Validator is created
>>
>> Look at
>> http://github.com/emmanuelbernard/hibernate-validator/blob/failFast/hibernate-validator/src/test/java/org/hibernate/validator/test/engine/failFast/FailFastTest.java
>> for code examples.
>>
>> Emmanuel
>>
>
More information about the hibernate-dev
mailing list