-
Notifications
You must be signed in to change notification settings - Fork 521
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
Unmarshal identical dedicatedColumns fields less often #3952
Conversation
5773af0
to
ec5aa7b
Compare
|
import "sync" | ||
|
||
var ( | ||
dedicatedColumnsKeeper = map[string]*DedicatedColumns{} |
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.
agree there's nothing better than a global var b/c of the way Unmarshal/Marshal works, but i'd like this data to have a lifecycle.
Should we add a "ClearDedicatedColumnsCache()" (or whatever) method that wipes this map called right before polling?
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.
Good call. I put this in the defer of the poller.Do so that we clear the memory when we're done with polling. I can see putting it at the beginning instead, but then we'd hold the memory even after we're done polling. Could do both I suppose, but this is probably okay.
ec5aa7b
to
dda05c3
Compare
dda05c3
to
e89c8e3
Compare
What this PR does:
Here we cache the unmarshaled DedicatedColumns in a package level map variable which is keyed by the bytes that were used to unmarshal.
A reasonable follow up might be to do the same kind of caching, but for each dedicated column. This would mean that we use the cached set of columns first, and if that isn't available, then use the cache for a single column.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]