Description
Hi,
I've seen an internal customer project being on an ancient version (0.1.3) and wanted to upgrade things. After the update to 1.0.69 (latest at the point of writing) things still seem to work, but show a major performance regression.
A little microbenchmark that validates a typical json for us shows the following numbers:
1.0.69
Benchmark Mode Cnt Score Error Units
MyBenchmark.testValidate avgt 10 46884,301 ± 764,721 ns/op
1.0.67
Benchmark Mode Cnt Score Error Units
MyBenchmark.testValidate avgt 10 26214,556 ± 425,732 ns/op
0.1.3
Benchmark Mode Cnt Score Error Units
MyBenchmark.testValidate avgt 10 14705,189 ± 986,189 ns/op
The regression between 1.0.67 and 1.0.69 can be largely traced back to the work on unevaluated properties in #534 & #544 , I think. Ideally, when the schema doesn't contain this keyword - like in our case - this overhead should be avoided.
The regression between 0.1.3 and 1.0.67 is probably caused by numerous things, but one bigger portion is likely driven by the CollectorContext
infrastructure and its repeated Map.get
calls. This is also why the unevaluated properties is so expensive I think.
The purple highlights in the following (reversed) flamegraph of 1.0.69 show the CollectorContext
being one of the main drivers.
For 1.0.67 it shows the following - less but still a significant time is spent on the CollectorContext
.
Cheers,
Christoph