-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: cache schema types #6970
perf: cache schema types #6970
Conversation
@anderseknert any ETA on when we would be able to land this? Currently we'd have to implement some workarounds prior to this getting landed for our next release. |
Looks like a small enough change to be able to land before the next release goes out this week. @ashutosh-narkar and @johanfylling's call. |
ast/check.go
Outdated
continue | ||
} | ||
|
||
ref := schemaAnnot.Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move this above
if refType == nil {
continue
}
and keep the original check
if ref == nil && refType == nil {
continue
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks good. It would be helpful if you could add a test case.
The type checker can't be accessed concurrently, right? 😅 |
There are existing map fields and I don't see a mutex so maybe not. Or maybe we have one at the call site. But I haven't checked the code. |
3aeb6a9
to
16999fc
Compare
✅ Deploy Preview for openpolicyagent ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@ashutosh-narkar How can you test caching if it's an internal implementation? Need to add performance tests? |
The tests on darwin failed, but from the logs I don't see why. |
If we could add some unit tests for |
@ashutosh-narkar @anderseknert do you know why the tests are failing? We don't see results in the CI log output stating anything is failing. |
Hi @ashutosh-narkar . The tests already cover all cache use cases. How can a test look like, without breaking encapsulation and explicitly checking for the presence of values in the cache? |
Signed-off-by: Nikita Pivkin <[email protected]>
16999fc
to
f761af5
Compare
This PR adds caching of schema types.
Fixes: #6969