Problem/Motivation
Each instance method that changes a layout, such as attachToRoot(), setSource() or setThirdPartySettings(), already saves the new revision through Instance::setNewPresent().
The API controllers then save the instance again, in nine places of ApiController and ApiActionsController.
The second save changes nothing, but it costs a full entity save, and it drops the instance from the entity cache once more, so the next load rewrites it.
Measured on a 2690-node layout, the extra save costs 44 to 60 ms per change, plus the cache rewrite; on an article display, 3 to 36 ms.
Proposed resolution
Remove the controller saves that follow an instance method which already saves. Add a kernel test that a change through the API saves the instance once.
Remaining tasks
- Remove the nine redundant saves.
- Kernel test: one save per change, for a library drop, a move, a settings update and a paste.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork display_builder-3630609
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
mogtofu33 commentedComment #6
pdureau commented