29. TIME  --  CPU Time
     Total CPU time the task has used since it started.  When Cumulative mode is On,  each  process  is  listed
     with  the cpu time that it and its dead children have used.  You toggle Cumulative mode with `S', which is
     both a command-line option and an interactive command.  See the `S'  interactive  command  for  additional
     information regarding this mode.

 30. TIME+  --  CPU Time, hundredths
     The same as TIME, but reflecting more granularity through hundredths of a second.

Let me know if you need something or if you want I try a specific debug release or options.

FYI, I use a lot of the generic feature, I don't use PHPStan attributes, and this is my config:

{
    /**
     * Visual Studio Code
     */
    "editor.formatOnType": false,
    "editor.formatOnSave": false,
    "editor.formatOnPaste": false,
    "editor.codeActionsOnSave": {
        "source.organizeImports": "never",
        "source.source.sortImports": "never",
        "source.source.sortAndRemoveImports": "never",
    },
    "files.insertFinalNewline": false,
    // Exclude files in the VS explorer
    "files.exclude": {
        /**
         * DO NOT EXCLUDE vendor and phpunit else
         * these folders will be not include
         * in Devsense PHPTools anymore
         */
        "vendor": false,
        "phpunit": false,
        "development": true,
        "documentation": true,
        "bin": true,
        "build": true,
        /**
         * Devsense bug:
         *    - https://community.devsense.com/d/828-yaml-functions-and-constants-are-missing/
         *    - https://community.devsense.com/d/894-php-problems-exclude-should-be-case-sensitive-or-enforce-relative-paths/
         *
         * This is a workaround to avoid to match all tools subfolder instead of the root folder only
         */
        "tools": false,
        "src/**/tools": false,
    },
    "search.exclude": {
        "bin": true,
        "build": true,
        "tools": true,
        "**/dist": true,
        "**/.angular": true,
        "**/node_modules": true,
        "phpclishell/vendor": true,
        "phpclishell/development": true,
        "phpclishell/phpunit/tests": true,
        "phpclishell/documentation": true,
    },
    "php.version": "8.3.9",
    "php.suggest.basic": false,
    "php.validate.enable": false,

    /**
     * DEVSENSE PHP Tools
     */
    "composer.workingPath": "phpclishell/",
    "php.workspace.includePath": "phpclishell/",

    // Disables some notifications about premium features like code actions.
    "phpTools.suppressPremiumFeatures": false,
    // AI suggestions
    "intelliphp.inlineSuggestionsEnabled" : false,
    "php.format.codeStyle": "Off",
    "php.format.rules.nullConstantCasing": "lowercase",
    "php.format.rules.booleanConstantCasing": "lowercase",
    "php.format.rules.groupUseNewLineBeforeFirstDeclaration": true,
    "php.format.rules.newLineAfterImplements": true,
    "php.format.rules.openBraceOnNewLineForFunctions": true,
    "php.format.rules.openBraceOnNewLineForLambdas": true,
    "php.format.rules.openBraceOnNewLineForAnonymousClasses": true,
    "php.format.rules.openBraceOnNewLineForTypes": true,
    "php.format.rules.indentBraces": false,
    "php.format.rules.elseOnNewLine": true,
    "php.format.rules.catchOnNewLine": true,
    "php.format.rules.finallyOnNewLine": true,
    "php.format.rules.spaceAfterCast": true,
    "php.format.rules.alignConsecutiveAssignments": false,
    "php.format.rules.alignMatchArmBodies": true,
    "php.format.rules.alignProperties": false,
    "php.format.rules.spaceBeforeParenthesesInControlStatements": false,
    "php.format.rules.spaceBeforeParenthesesInDeclarations": false,
    "php.format.rules.addCommaAfterLastArrayElement": true,
    "php.format.rules.arrayInitializersNewLineAfterLastElement": true,
    "php.format.rules.arrayInitializersNewLineBeforeFirstElement": true,
    "php.format.rules.arrayInitializersAlignKeyValuePairs": false,

    // Adds the full class member name at the top of tooltip (including the fully qualified name of the class) (disabled by default) (#808).
    "php.hover.fullname": true,
    // Lets you to enable/disable showing class name as a part of a function tool-tip (enabled by default).
    "php.hover.containingClass": true,
    // show full type names (shortened tu the current namespace) in tool tips.
    "php.hover.parametersFullName": true,
    // Inlay hints settings can be enabled
    "php.inlayHints.parameters.enabled": false,
    "php.inlayHints.types.lambdaParameter": false,
    "php.inlayHints.types.return": false,
    "php.docblock.variableSnippet": {
        "singleline": false,
    },
    "php.completion.parameters": "none",
    "php.completion.autoimport": "none",
    "php.stubs": [ "*", "pcntl", "posix", "ssh2", "yaml" ],
    "php.problems.scope": "all",
    "php.problems.exclude": {
        "phpclishell/bin/" : true,
        "phpclishell/vendor/" : true,
        "phpclishell/development/": true,
        "phpclishell/phpunit/": true,
        "phpclishell/tests/": [ 416, 6602, 6606 ],
        /**
         * 0416 : Undefined property
         * 6602 : Property x accessed via magic method
         * 6406 : Type x has been deprecated
         * 6606 : Constant from class X referenced through child
         */
        "phpclishell/src/phpCliShell/": [ 6406, 6606 ],
        "phpclishell/src/phpCliShell/Application/": [ 6602 ],
        "phpclishell/src/phpCliShell/Application/Netbox/": [ 416 ],
        "phpclishell/src/phpCliShell/Application/Firewall/Gui/**/node_modules/": true,
        "phpclishell/src/phpCliShell/Application/Firewall/Controller/Ipam.php": true,
    },

    /**
     * PHP CS Fixer
     */
    "php-cs-fixer.executablePath": "${workspaceFolder}/phpclishell/vendor/bin/php-cs-fixer",
    "php-cs-fixer.rules": "@PSR12",
    "php-cs-fixer.autoFixBySemicolon": false,
    "php-cs-fixer.autoFixByBracket": false,
    "php-cs-fixer.config": "phpclishell/phpcsfixer.php",
    "php-cs-fixer.onsave": true,
    "php-cs-fixer.documentFormattingProvider": true,
}

I use PHP CS Fixer, but not the format feature from your tool.
I will try to ignore a specific folder where I have HTML, CSS and typescript files.

Jean-FrancoisHIVERT Thank you for the settings; I'll try to address your notes/our bugs there.


I may suggest a few cleanups if you'd be interested:

disabled formatting

If you have disabled our formatter using the setting:

    "[php]": { "editor.defaultFormatter": "<something-else>" }
  • you can remove "php.format.codeStyle"
  • you can remove "php.format.rules***"
  • note, that we are the only extension providing format-on-type and format-selection for both PHP and mixed PHP/HTML/CSS/JS code.

"intelliphp.inlineSuggestionsEnabled": false

Instead, (if you are also not interested in AI code completion pre-select) you can uninstall or disable the extension "IntelliPHP". This will give you >200MB of RAM

disabled inlay hints

  • you can remove "php.inlayHints***" and set "editor.inlayHints.enabled": "off"

"php.problems.scope": "all"

It's a great feature that we are proud of, but be aware it takes RAM.

    @Jean-FrancoisHIVERT

    Those numbers are insane - CPU time should be just a few seconds.

    I'll prepare a development version that will measure exactly what is going on.

      Jean-FrancoisHIVERT

      There is pre-release 1.57.17062 with (experimental) diagnostic performance self-profiling;

      Following works in pre-release version of the extension on Windows:

      If you notice persistent high CPU, may I ask to collect performance data:

      • After Language Server starts, run the command "Begin Profiling Language Server ..."
      • Click OK, it downloads a component (48MB) and starts collecting data:
      • Do whatever is laggy or just let it collect data about the high CPU usage ...
      • Click Cancel to stop
      • Click Open Folder or navigate to .../tmp/devsense/selfprofile
      • Please zip the files (.dtp and .dtp.xxxx) and send it to us

      Thanks!


      NOTE 1: The data won't contain any workspace information, there are no sources. It's a bit experimental, we haven't tested all the environments yet.
      NOTE 2: profiling makes sense only during lags or when the CPU% is currently high
      NOTE 3: it is normal to have a high CPU% after opening the workspace

        Thank you, I did what you asked but after few seconds maybe 20 or 30s, I got a popup with the following error:

          Jean-FrancoisHIVERT Thank you,

          • is it Windows running a WSL/Ubuntu workspace?
          • In the lower-right corner - did you click OK or Cancel?
            status

            It is a linux VM, I use VS Code from my Windows, and connect to my VM with SSH.

            I clicked to OK and the button Cancel appeared correct.

            Jean-FrancoisHIVERT thanks;

            After more in-depth research we can do the profiling reliably only on Windows. Linux/Mac would be technically more tricky for now.

            I'll get back to it

              @Jean-FrancoisHIVERT does the CPU% issue solve by disabling workspace-wide analysis:

              or setting "php.problems.scope": "opened" instead of all

                4 days later

                It seems I don't have the performance issue anymore.
                I updated my config settings.json:

                • I updated the PHP version defined in the settings.json: "php.version": "8.3.16",

                Before, the running version was 8.3.16 and the defined version was 8.3.9

                • I removed some paths from the search locations: "search.exclude"
                  I removed a fodler/location for libraries:
                  drwxrwxr-x  2 renji renji 4096 Jan 28 17:32 box
                  drwxrwxr-x  2 renji renji 4096 Jan 28 17:32 composer
                  drwxrwxr-x  2 renji renji 4096 Jan 28 17:32 phpDocumentor
                  drwxrwxr-x  2 renji renji 4096 Jan 28 17:32 PHPLOC
                  drwxrwxr-x  2 renji renji 4096 Jan 28 17:32 PHPMD
                  drwxrwxr-x  3 renji renji 4096 Jan 28 17:32 UML

                Do you think it can be related to these changes?
                I can test to renable the library location to see if it is slow again.

                  Jean-FrancoisHIVERT interesting! I'm glad there is a progress.

                  • php.version should not have any effect, we don't run php internally
                  • search.exclude may affect VSCode itself, but not our devsense.php.ls process, since we are not using this setting yet (we will since the next update)
                  • removed unnecessary folders, or even excluding them using "files.exclude" setting may have great effect

                  We're also preparing update with fixed handling of file.exclude patterns - I have noticed you have some workarounds in your settings.json because we didn't handle glob patterns correctly

                    Write a Reply...