Swap StaticReflectionParser for PhpParser in HookCollectorPass

Created on 5 December 2024, 17 days ago

Problem/Motivation

xhprof reports that token_get_all() in StaticReflectionParser uses a lot of memory during the installer, so let's try swapping out the Doctrine code for nikic/php-parser.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

base system

Created by

πŸ‡¬πŸ‡§United Kingdom longwave UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @longwave
  • Merge request !10465Use nikic/php-parser for HookCollectorPass. β†’ (Open) created by longwave
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Unfortunately this doesn't help, it is just slower.

    Locally a standard install on 11.x is [11.47 sec, 252.17 MB]

    With this change it is [14.92 sec, 252.74 MB]

    Leaving this code here in case it is useful elsewhere where we want to avoid using token_get_all().

  • Pipeline finished with Failed
    17 days ago
    Total: 596s
    #360063
  • πŸ‡¨πŸ‡¦Canada Charlie ChX Negyesi 🍁Canada

    nikic/php-parser uses token_get_all or in php8 the newly introduced PhpToken but both of those call the Zend C function tokenize_common so that's pretty much the same. if the problem is in the Zend tokenizing system then changing the call chain to it won't help.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    Yeah, I think this is a false positive, it's not token_get_all() that's the problem - rebuilding the container does leak memory somewhere, but this isn't it.

Production build 0.71.5 2024