sul-dlss / cocina-models

Cocina repository data model (implemented in Ruby)
https://sul-dlss.github.io/cocina-models/
3 stars 0 forks source link

Validation performance improvements #473

Closed justinlittman closed 2 years ago

justinlittman commented 2 years ago

NOTE: Changes to openapi.yml require updating openapi.yml for sdr-api and dor-services-app and generating models - see README.

Why was this change made? 🤔

Improve performance by stopping redundant validation.

How was this change tested? 🤨

âš¡ âš  If this change has cross service impact, run integration tests and/or test in [stage|qa] environment, in addition to specs. âš¡

Before:

puts Benchmark.measure { Cocina::Models::Validators::Validator.validate(c.class, c) }
  1.381309   0.008735   1.390044 (  1.393821)

After:

puts Benchmark.measure { Cocina::Models::Validators::Validator.validate(c.class, c) }
  0.588038   0.007669   0.595707 (  0.596772)