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

perf: Improve call as service() #9248

Merged
merged 2 commits into from
Nov 9, 2024

Conversation

neznaika0
Copy link
Contributor

Description
Replace the use of Services::some() with service('some'). In theory, for large queries (> 100,000), the difference in execution will be noticeable.
#8607 #8623
All texts are executed, there should be no problems.

I left it unchanged tests/system/Config/ServicesTest.php
The examples in the documentation have not been changed.

It is not possible to call Services::createRequest()as a service ('createRequest)', rector says:

 ------ --------------------------------------------------------------------------------------------------------------- 
  Line   tests/system/Helpers/URLHelper/MiscUrlTest.php                                                                 
 ------ --------------------------------------------------------------------------------------------------------------- 
  :937   The method 'createRequest' is reserved for service location internals and cannot be used as a service method.  
         🪪  codeigniter.reservedServiceName                                                                            
 ------ --------------------------------------------------------------------------------------------------------------- 

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

Looks good.

Although using the Service class was nice from an IDE perspective - easy access to the method source. But performance is more important.

@neznaika0
Copy link
Contributor Author

Someday there will be a person who will create an IDE extension for CI 4. And we will improve the experience

@neznaika0 neznaika0 force-pushed the fix-call-as-service branch from f322c1c to ed9a1d3 Compare November 4, 2024 07:07
@ddevsr ddevsr added the refactor Pull requests that refactor code label Nov 4, 2024
@github-actions github-actions bot added the stale Pull requests with conflicts label Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

👋 Hi, @neznaika0!

We detected conflicts in your PR against the base branch 🙊
You may want to sync 🔄 your branch with upstream!

Ref: Syncing Your Branch

@neznaika0 neznaika0 force-pushed the fix-call-as-service branch 2 times, most recently from e7b9d12 to ac0b7db Compare November 5, 2024 18:35
@samsonasik
Copy link
Member

this needs rebase once more :)

@neznaika0 neznaika0 force-pushed the fix-call-as-service branch from ac0b7db to ea38947 Compare November 9, 2024 05:47
@samsonasik samsonasik removed the stale Pull requests with conflicts label Nov 9, 2024
@samsonasik samsonasik merged commit a9fa3d0 into codeigniter4:develop Nov 9, 2024
41 checks passed
@samsonasik
Copy link
Member

Thank you @neznaika0

@neznaika0 neznaika0 deleted the fix-call-as-service branch November 9, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants