Skip to content

Persistent WP instance to speed up WP-CLI #179

@kkmuffme

Description

@kkmuffme

Feature Request

Describe your use case and the problem you are facing

Since WP CLI always initiates a new PHP CLI/WP process, you have the WP overhead for every command, which makes it the slowest part of many pipelines.
Additionally having to specify common commands every time is a chore to write, e.g. --skip-plugins --skip-themes to make it faster.

if wp plugin is-active foo
then
    echo "do something"
fi

if wp plugin is-active bar
then
    echo "do something else"
fi

wp option update "hello" "world"

Describe the solution you'd like

Since PHP CLI has no/long timeouts, it would make sense to give the option to "launch" a WP instance once and then reuse it.

It would be faster when we launch a WP instance and then just read a file in a while loop like https://serverfault.com/a/1088115 to execute the commands passed subsequently.
This could be an optional thing with --persist=my-instance for example.

Since the WP overhead is between 150-350ms on a barebones WP install and much higher on slow servers or with many plugins, this would save tons of runtime.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions