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

Check empty string in ProductController::assignAttributesCombinations() #36039

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

Conversation

the-ge
Copy link
Contributor

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

Questions Answers
Branch? develop / 8.1.x
Description? Added a condition to skip the string processing for empty strings. Tested it on a 8.1.2 website, where I have products with 5k combinations from 4 attributes, making the ProductController::assignAttributesCombinations() method return an array with 20k elements. This optimization decreased the time needed by this method from 1.8 - 2.1 seconds to 1.4 - 1.6 seconds on my machine (Docker containers with PHP 8.1 on Manjaro Linux/i3-4170/16GB).
Type? improvement
Category? CO
BC breaks? no
Deprecations? no
How to test? Profile the product page for a product with lots of combinations, before and after the change.
UI Tests https://github.com/the-ge/ga.tests.ui.pr/actions/runs/8851875393
Fixed issue or discussion? Fixes #36004
Related PRs ---
Sponsor company Tenita Gabriel PFA

@the-ge the-ge requested a review from a team as a code owner April 26, 2024 16:56
@prestonBot prestonBot added the Improvement Type: Improvement label Apr 26, 2024
@Hlavtox
Copy link
Contributor

Hlavtox commented Apr 30, 2024

How there could be an empty string in the first place? Attribute value cannot be empty. 🤔

@the-ge
Copy link
Contributor Author

the-ge commented Apr 30, 2024

How there could be an empty string in the first place? Attribute value cannot be empty. 🤔

The subarrays do not contain only attribute values:

    [0] => Array
        (
            [id_attribute] => 1
            [id_attribute_group] => 1
            [attribute] => 25kg
            [group] => Ambalare
            [reference] => OP751VG0/N0100-25
            [ean13] => 
            [isbn] => 
            [upc] => 
            [mpn] => 

Anyway, meanwhile I found this is v1.6 legacy code, so this pull request should probably wait for #36056.

@the-ge
Copy link
Contributor Author

the-ge commented Apr 30, 2024

My bad, I falsely presumed that Github's "Sync fork" could be used to refresh the fork containing the pull request, so now this PR appears to be botched. Sorry, not a Git expert by far.
Can it be salvaged or should I close it and make another one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Type: Improvement
Projects
Status: Need 2nd approval
Development

Successfully merging this pull request may close these issues.

None yet

4 participants