Skip to content

Slow startup caused by large unconditional static import tree #24868

Closed as not planned

Description

@antonok-edm

Description

OpenCode cold starts are noticeably slow, even when running e.g. --version, --help, or other simple CLI-only subcommands.

My benchmarking revealed a large delay coming from import resolution. The CLI entrypoint index.ts file has 41 imports. More than half of those are subcommand handlers, of which only one would ever be called at a time.

Plugins

None

OpenCode version

1.14.29

Steps to reproduce

  1. Run time opencode --version on a relatively modern computer
  2. ...wait for more than half a second for the command to finish

Screenshot and/or share link

No response

Operating System

Arch Linux

Terminal

Alacritty

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    perfIndicates a performance issue or need for optimization
    on Apr 29, 2026
  2. antonok-edm commented on Apr 29, 2026

    @antonok-edm
    Author

    My proposal is to convert all Command imports from the index.ts entrypoint into dynamic import()s that are only pulled in when invoked by the CLI.

  3. removed
    bugSomething isn't working
    perfIndicates a performance issue or need for optimization
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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