Stranger6667/jsonschema-rs

Performance: Cache `format: regex`

Opened this issue · 0 comments

The idea comes from #416. It might make sense to keep some shared LRU cache for the format: regex validator.

Assumption: compiling regex on each validation is expensive, but input regexes are often repeated.

Hash lookups for String will be much less expensive than compiling a regex, so we can make one extra lookup every validation in hope that regex is already cached (and translated to JS style).

It could be schema-level or even global.