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

Removed unused ProductController::assignAttributesCombinations() method and call #36056

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

the-ge
Copy link
Contributor

@the-ge the-ge commented Apr 30, 2024

Questions Answers
Branch? develop / 8.1.x / 8.0.x / 1.7.8.x / 1.7.7.x
Description? The ProductController::assignAttributesCombinations() method assigns an array of attribute combinations (with size being the count of attributes x count of product combinations, i.e. 4 x 5000 in my case) as a Smarty template variable. As the count of attributes and product combinations increase, this consumes more and more resources. Recent improvements directed at reducing resources consumed are #34453 and #36039. The thing is, the template variable this method assigns seems to have been last used in PrestaShop v1.6, so the method and the call to it should be removed altogether.
Type? bug
Category? CO
BC breaks? no
Deprecations? no
How to test? Acces the product page.
UI Tests https://github.com/the-ge/ga.tests.ui.pr/actions/runs/8888692163
Fixed issue or discussion? Fixes #36051
Related PRs This PR makes #36039 superfluous.
Sponsor company Tenita Gabriel PFA

@the-ge the-ge requested a review from a team as a code owner April 30, 2024 03:06
@prestonBot
Copy link
Collaborator

Hi, thanks for this contribution!

I found some issues with the Pull Request description:

  • The type should be one of these: new feature, improvement, bug fix or refacto (Read explanation).

Would you mind having a look at it? This will help us understand how interesting your contribution is, thank you very much!

(Note: this is an automated message, but answering it will reach a real human)

@Hlavtox
Copy link
Contributor

Hlavtox commented Apr 30, 2024

This could be used by some templates to list all possible variants. 🤔
Ping @kpodemski @ShaiMagal

@the-ge
Copy link
Contributor Author

the-ge commented Apr 30, 2024

I can (hardly) imagine themes created for 1.6 and then upgraded all the way to 8.1.x.
Is it reason enough to keep code unused in the core since 2016?

@kpodemski
Copy link
Contributor

Hello @the-ge

While I could agree that this method has been rarely used, we cannot just remove it, we need to deprecate it first, and then remove it in the next major release.

@the-ge
Copy link
Contributor Author

the-ge commented May 7, 2024

Well, the method is used by the core itself on every product page creation. What's not used is its work result. Deprecating this method will only fill the log with deprecation messages telling the core developers to stop using it. Am I missing something?

@kpodemski
Copy link
Contributor

@the-ge that's why I like your fix from separate PR better, it fixes the problem while keeping everything working

@the-ge
Copy link
Contributor Author

the-ge commented May 8, 2024

Hmm, the way I'm seeing them now, these are the choices:

  1. We apply the 36039 patch for a minor optimization. The controller will still waste resources on unused processing and there's still no clear path to the useless code retirement.
  2. We apply this patch, rendering 36039 irrelevant. The potential issue is now the existence of a theme that's using this code. We are on the develop branch, which means the theme should've been created for PrestaShop 1.6 and then updated to 1.7, then updated to 8.0, then updated to 8.1. And we do not want to affect the said theme, because...

Well, I do not really know why a theme with v1.6 legacy code should be protected. From my point of view, the PrestaShop theme market state is not that good - saturated with builder-based monsters creating multi-MB JavaScript and, worse, multi-MB CSS pages with abysmal performance. Choosing legacy instead of performance only adds to this state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for review
Development

Successfully merging this pull request may close these issues.

v1.7-8 performance: ProductController::assignAttributesCombinations() seems unused since v1.6
4 participants