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

Avoided unnecessary calls to string translation methods for catalog/sales rules labels #3140

Merged
merged 2 commits into from
Apr 8, 2023

Conversation

luigifab
Copy link
Contributor

@luigifab luigifab commented Apr 4, 2023

Description

This PR stop translations of rules labels from frontend.
Perhaps the best way is to remove all translations from model, and translate only from blocks? I don't know.

Here a before/after with Blackfire with a cart with ~50 products (simple, configurable, bundles):

original (before):
big-cart-before

after without the static property:
big-cart-after-effect

after:
static
big-cart-after

Can fix partially #3127 or not.
Tested with PHP 8.0 and 8.2 with OM rc2.

If you have others modules or custom dev, that do the same, you need to update your files to have better performance on your website. Example with HiPay module's.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added Component: CatalogRule Relates to Mage_CatalogRule Component: Rule Relates to Mage_Rule Component: SalesRule Relates to Mage_SalesRule labels Apr 4, 2023
@luigifab luigifab added the performance Performance related label Apr 4, 2023
@fballiano
Copy link
Contributor

wow, I wasn't expecting the __ to generate all those calls, I thought it would immediately hit a cache :\

@fballiano fballiano changed the title Do not translate rules labels Avoid unnecessary calls to string translation methods for catalog/sales rules labels Apr 5, 2023
@joshua-bn
Copy link
Contributor

Does it make any difference for time?

@fballiano
Copy link
Contributor

if I read the screenshots correctly it goes from 5secs to 3.6secs (with @luigifab's DB data obviously)

@fballiano fballiano changed the title Avoid unnecessary calls to string translation methods for catalog/sales rules labels Avoided unnecessary calls to string translation methods for catalog/sales rules labels Apr 8, 2023
@fballiano fballiano merged commit 2189fcb into OpenMage:main Apr 8, 2023
@luigifab luigifab deleted the translate-rules branch April 9, 2023 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CatalogRule Relates to Mage_CatalogRule Component: Rule Relates to Mage_Rule Component: SalesRule Relates to Mage_SalesRule performance Performance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants