-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Consider this schema and these two payloads:
test.schema.json
{
"type": "object",
"properties": {
"foo": {
"type": "string"
}
},
"if": {
"properties": {
"foo": {
"const": "foo"
}
}
},
"then": {
"properties": {
"bar": {
"const": "bar"
}
}
}
}
test.json
{
"foo": "foo",
"bar": "bar"
}
test-big.json
{
"foo": "foo",
"bar": "bar",
"foo1": "foo",
"foo2": "foo",
...
"foo99": "foo",
"foo100": "foo"
}
Running justify over these payloads (code.zip) 1M times yields these results:
test.json: 14835 ms
test-big.json: 55362 ms
Now this could be due to parsing cost of bigger map, so let's remove the if-then keywords and try again.
test.json: 13994 ms
test-big.json: 38727ms
Hence it is clear that something else is going on.
After running the code through debugger, I believe this is because ConditionalEvaluator's evaluate method is called for every key in the payload. Is this something that can be optimized?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels