karenetheridge / JSON-Schema-Modern

Validate data against a schema using a JSON Schema
https://metacpan.org/release/JSON-Schema-Modern/
Other
10 stars 1 forks source link

store lightweight annotations when only needed for other applicator keywords #73

Closed karenetheridge closed 1 year ago

karenetheridge commented 1 year ago

Profiling shows we spend a lot of time constructing annotation objects and the Mojo::URLs that are contained by them. When there are errors we throw them away, and even on success most of the time the caller isn't interested in them; they are only accumulated for the benefit of unevaluated* keywords.

We can still collect annotation data internally for applicator keywords by only tracking lightweight annotation data until we know the caller actually wants them. This means that the initial traversal for calculating the collect_annotationsconfig should instead calculate a different state value.

"real" annotations that remain by the end of evaluation can be inflated into real Annotation objects.

karenetheridge commented 1 year ago

This is done in version 0.558.