cache the results of lookups for qt_query_status_type and qt_query_re…#26
Open
XcrigX wants to merge 1 commit intoi2b2:masterfrom
Open
cache the results of lookups for qt_query_status_type and qt_query_re…#26XcrigX wants to merge 1 commit intoi2b2:masterfrom
XcrigX wants to merge 1 commit intoi2b2:masterfrom
Conversation
…sult_type to avoid repeated calls Signed-off-by: craig mcclendon <cgithub@loudog.org>
e920f7c to
dbffe8f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR just caches the results of lookups for qt_query_status_type and qt_query_result_type to avoid repeated calls. These get called repeatedly to lookup the status code values, and as far as I can tell the data should be static. In a simple test it reduced the number of SQL statements executed against the the QT_xxx tables on startup from ~150 down to ~60 (depending on the query history). This load reduction will occur whenever the Queries frame is refreshed as well.
NOTE: this could be done even better by running a "select * " once initially and caching all the values, but it was a more light-weight change to just cache the individual calls for the same values so at least it doesn't need to lookup a given code more than once.