Problem/Motivation

Why do we sometimes not use the infoParser?

Let's remove that option and always use it.

Steps to reproduce

N/A

Proposed resolution

Remove the use_info_parser parameter.
I only see usage in tests and core, I propose we do a hard break here since it's in the middle.
We can create an issue in the 4 projects that even set it.

Remaining tasks

Determine if we need to deprecate it or can just remove it, a few contrib do change the default:
https://git.drupalcode.org/project/ai/-/blob/68de4bcc381e8abec865fed5485...
https://git.drupalcode.org/project/automatic_updates/-/blob/5c41897b0992...
https://git.drupalcode.org/project/raw_fields_formatters/-/blob/423e2dd5...
https://git.drupalcode.org/project/eme/-/blob/6e292468d5a726233d2324e786...

They are all tests, I can create an issue in each.
https://search.tresbien.tech/search?q=ExtensionDiscovery%20-r%3Adrupal

User interface changes

N/A

Introduced terminology

N/A

API changes

Technically now name and core_version_requirement are now always required.
The parameters changed for ExtensionDiscovery
info.yml caches earlier in FileCache

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3618545

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nicxvan created an issue. See original summary.

nicxvan changed the visibility of the branch 3618545-always-use-infoparser to hidden.

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
Status: Active » Needs review

Do we need a CR for this?

nitinkumar_7’s picture

This removes the $use_info_parser = FALSE path and makes InfoParser mandatory, so ExtensionDiscovery::scan() now always parses the complete .info.yml file instead of using the previous lightweight type: lookup. Could we add or extend a test covering the discovery behavior that previously used $use_info_parser = FALSE, to make sure there isn't an unintended behavioral or performance regression?

nitinkumar_7’s picture

Also, since the ExtensionDiscovery constructor signature is changing, this looks like a public API change. Could we confirm whether a change record is needed for this?

catch’s picture

Constructors are considered @internal but we should add a change record anyway probably.

alexpott’s picture

We're going to need to consider the performance ramifications of this change. I'm pretty sure this exists to stop thousands of yaml reads during install.

catch’s picture

We do a lot of YAML info parsing during install already, per #3616275: Use the PECL YAML parser for info file parsing when available although yes it would be good to check how much, if any, this adds on top of that.

But last time I looked at this (some time ago around #3493423: Deprecate the $use_info_parser parameter to ExtensionParser::scanDirectory()) we were often doing the custom parsing once and then parsing the YAML again in the same request.

alexpott’s picture

On a minimum install using Drush

HEAD

*** SPX Report ***

Global stats:

  Called functions    :     5.2M
  Distinct functions  :     7.5K

  Wall time           :    2.41s
  ZE memory usage     :   70.2MB

MR

*** SPX Report ***

Global stats:

  Called functions    :     5.5M
  Distinct functions  :     7.5K

  Wall time           :    2.49s
  ZE memory usage     :   72.1MB

So we're using more function calls and and more memory - what is the motivation behind this change other than less options in the constructor?

alexpott’s picture

If we add this MR plus the pecl yaml together we get

*** SPX Report ***

Global stats:

  Called functions    :     5.0M
  Distinct functions  :     7.5K

  Wall time           :    2.38s
  ZE memory usage     :   72.1MB

So less function calls - which makes sense - but still the increased memory usage...

catch’s picture

Did some quick profiling.

I hacked GenericTestBase to do an early return, and then node module's GenericTest with HEAD vs. the MR with xhprof enabled. The MR adds only two calls to Yaml::decode()

1324 in HEAD and 1326 with the MR.

catch’s picture

The different profiling results are interesting. I'm wondering how much this is the real installer vs running a functional test, or whether drush is also doing some extension parsing itself to find plugins etc. Once way to find out would be to compare drush to dr install I guess (or look at the specifics of what's calling this from drush).

Note there's also #3303751: Reduce the number of times UpdateRegistry scans for extensions which is postponed on this issue.

catch’s picture

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

nicxvan’s picture

Status: Needs work » Needs review

Rebased, updated the call in UpdateRegistry