Skip to content

phptools: hardcoded --composerNodes false roughly doubles memory usage on large Laravel projects #132

Description

@shaheenfawzy

Summary

phptools.rs hardcodes --composerNodes false when launching devsense.php.ls:

args: vec![
    "--composerNodes".into(),
    "false".into(), // disable /vendor/ caching
],

Per the server's own --help, this flag controls composer package caching and defaults to true:

-composerNodes:   Enable or disable composer nodes caching. Default is True.

With the cache disabled, the server re-parses the entire vendor/ tree on startup and keeps the whole composer dependency graph in memory per instance, instead of reusing its global per-package cache (~/.local/share/DEVSENSE/packages-cache/<vendor>/<pkg>.<version>.json.gz, keyed by package+version and shared across projects). On large Laravel codebases this roughly doubles baseline memory and makes every edit trigger heavy re-analysis.

For comparison, DevSense's own VS Code extension does not pass this flag at all (cache enabled).

Measurements

Same Laravel project (~47k files under vendor/), same devsense.php.ls binary (1.0.19075), driven over LSP with identical phases:

Phase default (cache on) --composerNodes false
after initial index 1263 MB 2244 MB
idle 60s 1263 MB 2244 MB
didOpen 150 PHP + 150 blade files 1208 MB 2289 MB
300 didChange edits 1293 MB, responsive sustained CPU churn, analysis backlog
2000 didChangeWatchedFiles events 1288 MB n/a (still churning)

With the cache enabled, memory stays flat through every stress phase. With it disabled, baseline is ~1 GB higher and edit storms cause long re-analysis bursts. Since Zed starts one server instance per worktree (and Laravel users typically also run the blade extension, which spawns its own copy), the per-instance overhead multiplies quickly — this is very likely the mechanism behind reports like #54.

Suggested fix

Either drop the flag (matching the upstream default and DevSense's own VS Code extension), or make it configurable through the extension's settings, e.g.:

"lsp": {
  "phptools": {
    "settings": { "composerNodes": true }
  }
}

Happy to test a build against the same benchmark.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions