Skip to content

Major performance regression caused by unevaluatedProperties #564

Closed
@dreis2211

Description

@dreis2211

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.
image

For 1.0.67 it shows the following - less but still a significant time is spent on the CollectorContext.
image

Cheers,
Christoph

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions