Hi,
a difference in validation time is expected, but your case sounds like a lot. How many validations are you executing? How many different beans and how many constraints per bean. I would love to get more information.
If you are validating many different beans, the validation time for the first validation is expected to be slower. The metadata for this particular bean time needs to be created and as you say it will be cached.
Most important performance recommendation is to not throw away the ValidatorFactory. The cache works per factory. Validator instances are lightweight and can be easily re-created.
Depending on your usecase you might want to consider some pre-warming of the caches, but there are no other special options to perform faster. Depending on your usecase and if you have very deep object graphs you could try the failFast which is specific to Hibernate Validator and will stop the validation on the first validation error.
--Hardy
|