Skip to content
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

Optimization of FormMapper::findById calls #1707

Merged

Conversation

AIlkiv
Copy link
Contributor

@AIlkiv AIlkiv commented Sep 1, 2023

Motivation:

There is a method called ApiController::getSharedForms, which is invoked on the main page of the module.

This method retrieves all web forms without exception.

And then this method invokes various other methods to obtain the Form using its formId. In essence, it performs N (representing the total number of forms in the system) additional requests to the database. Even if these requests are somehow cached, they still amount to N unnecessary cache requests.

For other methods, the number of findById calls is reduced.

@codecov
Copy link

codecov bot commented Sep 1, 2023

Codecov Report

Merging #1707 (29d2b6f) into main (0c2eb7e) will decrease coverage by 0.22%.
Report is 2 commits behind head on main.
The diff coverage is 70.21%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1707      +/-   ##
============================================
- Coverage     42.33%   42.12%   -0.22%     
  Complexity      570      570              
============================================
  Files            55       55              
  Lines          2388     2381       -7     
============================================
- Hits           1011     1003       -8     
- Misses         1377     1378       +1     

@AIlkiv
Copy link
Contributor Author

AIlkiv commented Sep 16, 2023

@Chartman123 could you kindly perform a code review, please?

@Chartman123
Copy link
Collaborator

Hi @AIlkiv

sorry, I don't have much time at the moment. Will try to review your PR next week.

@susnux susnux added enhancement New feature or request php PHP related ticket 3. to review Waiting for reviews performances Performances issues and optimisations labels Sep 28, 2023
Copy link
Collaborator

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work, code looks good and make sense

Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for me as well :) Could you please do another rebase on latest main and then I think we can merge this one.

Signed-off-by: Andrii Ilkiv <a.ilkiv.ye@gmail.com>
@susnux susnux force-pushed the optimization-of-formMapper-findById-calls branch from 7c94bc7 to 29d2b6f Compare September 28, 2023 20:38
@susnux susnux merged commit c26470b into nextcloud:main Sep 29, 2023
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request performances Performances issues and optimisations php PHP related ticket
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants