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

refactor: Optimize AuthToken/AuthJWT Config Loading by Initializing in Constructor #1252

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

datamweb
Copy link
Collaborator

@datamweb datamweb commented Feb 16, 2025

Description
AuthToken and AuthJWT Config Loading by Initializing in Constructor

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

@datamweb datamweb added the refactor Pull requests that refactor code label Feb 16, 2025
@datamweb datamweb changed the title refactor: Optimize AuthToken Config Loading by Initializing in Constructor refactor: Optimize AuthToken/AuthJWT Config Loading by Initializing in Constructor Feb 16, 2025
Copy link
Member

@paulbalandan paulbalandan left a comment

Choose a reason for hiding this comment

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

Do you have a benchmark for this change?

@datamweb
Copy link
Collaborator Author

Do you have a benchmark for this change?

The presence of Optimize probably led to this question. It seems I made a mistake in choosing it, as my main goal in this configuration was to prevent the repeated use of config('AuthToken') and config('AuthJWT'), nothing more.

But now I’m curious—does this change actually impact performance or not? Your benchmark results could be really helpful! @paulbalandan If possible, please share them so we can analyze them together.

@paulbalandan
Copy link
Member

Yes, the word Optimize in your PR title made me curious about the impact to performance since we will now be loading the configs everytime a class is instantiated. I just remembered one time when I did a similar change to the Seeder class instantiating Faker's Generator everytime in the constructor caused a massive slowdown.

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.

2 participants