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

Extract recursive method from ConfigPostProcessor::__invoke() to avoid performance hit #102

Merged

Conversation

Xerkus
Copy link
Member

@Xerkus Xerkus commented Jul 29, 2022

Q A
Documentation no
Bugfix yes
BC Break no
New Feature no
RFC no
QA no

Description

Replacements initialization depends on additional configuration from $config, for
that reason it is delayed until config post processor is invoked.
However, __invoke() method is used recursively leading to unneccessary
reinitialization of Replacements and a significant performance hit.

Functionality is extracted into processConfig() to be used internally
for recursive calls.

Replacements initialization depends on additional configuration from config, for
that reason it is delayed until config post processor is invoked.
However, __invoke() method is used recursively leading to unneccessary
reinitialization of Replacements and a significant performance hit.

Functionality is extracted into processConfig() to be used internally
for recursive calls.

Signed-off-by: Aleksei Khudiakov <aleksey@xerkus.pro>
@Xerkus Xerkus changed the base branch from 1.7.x to 1.6.x July 29, 2022 13:17
@Xerkus Xerkus added the Bug Something isn't working label Jul 29, 2022
@Xerkus Xerkus linked an issue Jul 29, 2022 that may be closed by this pull request
@Xerkus Xerkus added this to the 1.6.1 milestone Jul 29, 2022
@Xerkus
Copy link
Member Author

Xerkus commented Jul 29, 2022

I did not fix the psalm complaints that were covered by baseline and instead moved them along with extracted code. No tests are needed since behavior did not change.

Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

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

Argghh.. thanks for spotting the recursion, @Xerkus; that would definitely lead to the performance issue reported. Nice work extracting that method!

🚢

@weierophinney weierophinney merged commit e112dd2 into laminas:1.6.x Jul 29, 2022
Copy link

@ThanksOihyuo ThanksOihyuo left a comment

Choose a reason for hiding this comment

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

Г

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance Issue with 1.6.0
3 participants