-
Notifications
You must be signed in to change notification settings - Fork 712
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
Remove pointer math (comparison) from render caching, as it is unreliable #962
Conversation
07ede23
to
b66ff05
Compare
The code/approach looks fine. However, I don't know enough about this part of the code to confirm whether it's complete or it's missing edge cases. |
I feel the same. Will have reviewed by @tomwilkie |
b66ff05
to
a0a60ca
Compare
After in-person discussion fons suggests generating a stable/random ID for each renderer, and using a single-cache against that. |
Makes cache clearing easier, and then we don't need to add `ResetCache()` to the Renderer interface.
f371ebd
to
0379fc4
Compare
Much cleaner 👍 That said, it won't work against mutable renderers. Are all renderers immutable? |
afaik, yes. |
They are all deterministic (which I think is the property we want here). The renderers themselves are structs which are not inherently immutable, but we don't mutate them anywhere. |
I could get this to flake in a loop pretty easily. Will test tomorrow with this fix. |
default: | ||
return m.Renderer.Render(rpt) | ||
} | ||
key := fmt.Sprintf("%s-%s", rpt.ID, m.id) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Flakes reliably on master:
Ran for 5mins on this branch with no flakes. |
Remove pointer math (comparison) from render caching, as it is unreliable
As mentioned in #896 (comment)
Might fix the flakey test? Not sure. Either way
reflect.Value.Pointer
of a func is unreliable.The tradeoff is that we have individual caches for each renderer, and have to forward
ResetCache
calls throughout the tree, which is ugly.