craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
226 stars 170 forks source link

[4.x]: ProductTypes service: backward compatibility causes lack of performance by parsing external all project config files #3031

Closed sebschaefer closed 1 year ago

sebschaefer commented 1 year ago

What happened?

Description

When working with product types, the service is reading and parsing all external config files to retrieve the current commerce schema version (changed field name "titleFormat" in 4.0.0). We've got 430 yaml files here resulting in a notable performance impact.. Relevant commit: https://github.com/craftcms/commerce/commit/be6529850f967edf2e22e881979f64aa89dd5cdb

Steps to reproduce

  1. call any ProductTypes->get..() method (which uses _createProductTypeQuery())

Expected behavior

Actual behavior

use external project config to determine fieldname

Craft CMS version

4.3.1

Craft Commerce version

4.2.2

PHP version

8.1.12

Operating system and version

debian 11.5

Database type and version

mariadb 10.7.1

Image driver and version

No response

Installed plugins and versions

Name                          Handle              Package Name                           Version              Installed  Enabled
----------------------------  ------------------  -------------------------------------  -------------------  ---------  -------
Accounting                    accounting          humans/commerce-accounting             4.0.0                Yes        Yes
Amazon S3                     aws-s3              craftcms/aws-s3                        2.0.1                Yes        Yes
Amazon SES                    amazon-ses          putyourlightson/craft-amazon-ses       2.0.1                Yes        Yes
Asset Usage                   assetusage          born05/craft-assetusage                3.0.0                Yes        Yes
Braintree for Craft Commerce  commerce-braintree  webdna/commerce-braintree              3.0.0-beta.1         Yes        Yes
Campaign                      campaign            putyourlightson/craft-campaign         2.2.1                Yes        Yes
Commerce Bundles              commerce-bundles    webdna/commerce-bundles                2.0.0-beta.3         Yes        Yes
Control Panel JS              cp-js               doublesecretagency/craft-cpjs          2.5.0                Yes        Yes
core                          core                humans/core                            4.0.0                Yes        Yes
CP Field Inspect              cp-field-inspect    mmikkel/cp-field-inspect               1.4.4                Yes        Yes
Craft Commerce                commerce            craftcms/commerce                      4.2.2                Yes        Yes
Deployment Bridge             deploymentbridge    humans/deploymentbridge                dev-feature/craft_4  Yes        Yes
Expanded Singles              expanded-singles    verbb/expanded-singles                 2.0.0                Yes        Yes
Freeform                      freeform            solspace/craft-freeform                4.0.7                Yes        Yes
Logs                          logs                ether/logs                             4.0.0                Yes        Yes
Matrix Colors                 matrix-colors       doublesecretagency/craft-matrixcolors  2.1.0                Yes        Yes
Media                         humans-media        humans/media                           dev-feature/craft_4  Yes        Yes
Minify                        minify              nystudio107/craft-minify               4.0.0-beta.2         Yes        Yes
MJML                          mjml                superbig/craft-mjml                    2.0.0                Yes        Yes
P&L                           pl                  humans/pl                              4.0.0                Yes        Yes
Redactor                      redactor            craftcms/redactor                      3.0.2                Yes        Yes
Sentry SDK                    sentry-sdk          born05/craft-sentry                    2.0.1                Yes        Yes
sharecart                     sharecart           humans/sharecart                       4.0.0                Yes        Yes
Sherlock                      sherlock            putyourlightson/craft-sherlock         4.2.0                Yes        Yes
SS Entry Importer             ss-entry-importer   ssplugin/ss-entry-importer             1.0.4                Yes        Yes
Super Table                   super-table         verbb/super-table                      3.0.5                Yes        Yes
Translations admin            translations-admin  mutation/translate                     3.0.1                Yes        Yes
Commerce Widgets              commerce-widgets    bymayo/commerce-widgets                3.0.0                Yes        No
Control Panel Nav             cp-nav              verbb/cp-nav                           4.0.8                Yes        No
FastCGI Cache Bust            fastcgi-cache-bust  nystudio107/craft-fastcgicachebust     4.0.0-beta.1         Yes        No
SEOmatic                      seomatic            nystudio107/craft-seomatic             4.0.12               Yes        No
lukeholder commented 1 year ago

This will be fixed in the next release due out soon.