-
Notifications
You must be signed in to change notification settings - Fork 898
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
VimPerformanceState#vim_performance_state_for_ts optimizations #22611
Conversation
update:
|
update:
|
defaulting to passing time into the method. Places calling it, ensure that Fixing: sometimes we were passing non iso8061 into the method so it was not finding the cached VimPerformanceState records | ms | bytes | objects |query | qry ms | rows |` comments` | ---:| ---:| ---:| ---:| ---:| ---:| --- | 1,699.1 | 19,618,021* | 283,526 | 9 | 1,519.6 | 79 |`before` | 1,664.1 | 15,672,327* | 225,826 | 5 | 1,550.8 | 75 |`after-fetch-time`
wanted to create specs around vim_performance_state_association and hit a tangent. This already cached newly created vim_performance_state records when one did not exist in the db but it never looked for that value in the local cache. now it looks that value up
since perf_capture_state does a find for now, not reason to try and find it first have tried to remove this extra query a few times. previous attempts deleted this line. this one is different as we added the unless. there were a few cases that we do want a find here. (luckily there are tests around this)
Checked commits kbrock/manageiq@0d34281~...e6268fc with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
update:
|
state = vim_performance_states.detect { |s| s.timestamp == t } | ||
end | ||
# look for state from previous perf_capture_state call | ||
state ||= @states_by_ts[ts_iso_now] |
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 part is confusing to me. The right hand side will only execute if state is nil which means it would have ran the previous if state.nil?
block. That block fetches a state using ts_iso_now. That means this line can only be run if it couldn't get a state using ts_iso_now, but then we use ts_iso_now to lookup into the @states_by_ts
?
Backported to
|
VimPerformanceState#vim_performance_state_for_ts optimizations (cherry picked from commit 1a00c40)
commits:
VimPerformanceState
.now
before callingperf_capture_state
. (capture also does this query)@param
documentation for someTime
values passed around