Use static caching to reduce lookups in import display #29059
Merged
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.
Overview
Use static caching to reduce lookups in import display
Before
When loading an import display the
modifiySpec
function is called once per editable field * the number of lines. As each field is set to editable this means the number of columns in the csv * the number of rows. Commonly the number of columns is large because an export from civicrm has a large number of columns and the default number of rows displayed is 25 - so in the api call that is cached here is called hundreds of times (at least) to render the viewAfter
The use of the static cache removes this point of repetitiveness - and makes sense IMHO but the
getEditableInfo
function remains extremely slow as this is small part of that functionTechnical Details
I used static caching rather than metadata cache as the information is quick to load and that way we can do it once per job. If we use the cache then we get into how we clear it & wind up putting all the jobs in one cache - which risks being slow to serialize & unserialize
Comments