Skip to content

[Performance] CLI Startup Delay (15s-25s) caused by JITI Alias Map & Plugin Loader I/O #63948

Description

@atopyang

Describe the bug
There is a severe performance bottleneck during CLI startup (openclaw status, openclaw tasks list, etc.), causing delays of 11s+ on Linux and up to 25s+ on Windows (NTFS).

Through deep CPU profiling (NODE_OPTIONS="--cpu-prof"), we have identified that the delay is not network-related, but stems from extreme CPU/IO overhead in the Plugin Loader's interaction with jiti.

To Reproduce

  1. Run time openclaw status on a Windows machine or a Linux machine with a few plugins (like lossless-claw) in ~/.openclaw/extensions/.
  2. Observe the 15s-25s startup time.
  3. Profile it: NODE_OPTIONS="--cpu-prof" openclaw status.

Root Cause Analysis
The CPU profile reveals that jiti and the OpenClaw SDK loader spend massive amounts of time doing global filesystem traversal and alias normalization on every startup:

2479 ticks - normalizeAliases file:///.../jiti.cjs
1162 ticks - get exports node:internal/modules/package_json_reader
1087 ticks - get exports ... (without plugin)
984 ticks - parsePackageName
194 ticks - buildPluginLoaderAliasMap
160 ticks - loadPluginManifest

Because plugins use virtual paths like openclaw/plugin-sdk/*, the CLI loader builds a massive Alias Map. jiti then aggressively intercepts and string-matches these aliases, parsing package.json files repeatedly across the filesystem. Pre-compiling plugins to .js locally does not bypass this, as jiti still intercepts the runtime execution.

Expected behavior
CLI startup should be near-instant. The loadPluginManifest and buildPluginLoaderAliasMap need persistent caching across CLI runs, or jiti interception needs a fast-path that avoids recursive filesystem IO on static plugin trees.

Reported by: Jimmy & Ops-Pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions