Search code examples
nhibernatenhibernate-validator

NHibernate validator performance


What do you know about NHibernate validator performance? I plan to use it, but it use reflection and I worry about performance...


Solution

  • If you refuse to run .net code just because it uses reflection, you'll have very few bits left available to run. Use of reflection does not imply a significant performance hit. Unless you have to run some reflection code in a tight loop or have to run on a low-powered processor (mobile perhaps), or is incorrectly used, reflection is not typically a significant hit to the overall application performance. Even so, reflection is usually cached so it only happens once per operation. In the concrete case of NHibernate.Validator, most (all?) of the reflection work happens at startup only.

    If you know you have special performance requirements, measure it, just as everything else involved.