Dedupe ancestor title requests and lookup once per field #3025
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 addresses 2 issues we encountered with "search" adjacent performance rendering the context cell (particularly with larger page sizes).
Currently a call to
get_ancestor_title
is made at least twice per "ancestor". Once to see if there's a value, then again to get the value. The PR updates this to just happen once and use the result.Requests for ancestors are repeated per result (record). If a result shares ancestors the same request is being made without reference to any previous lookups for the same "ancestor". To help with this this PR goes with a minimally intrusive approach of introducing a local variable per controller action. It's simple, can be easily replaced or updated in the future for something more sophisticated (it may eventually be better to do something that isn't requesting an entire json record to get a single field), but does the job of reducing the no. of requests to once per "field" (uri), per search request.
Using the ATTracer repository and searching for "bulk":
master (118 requests):
PR (11 requests):
Types of changes
Checklist: