pixi icon indicating copy to clipboard operation
pixi copied to clipboard

perf: make building `reqwest_clients` lazy

Open ruben-arts opened this issue 1 year ago • 2 comments

Due to the creation of the reqwest_clients on every initialization of the command dispatcher pixi run or any pixi command that validates the lockfile will spend extra time that might not be required as it is only important to have the reqwest client when actually contacting the internet.

On my M4 Pro this takes ~130ms which is 60% of a pixi run echo in this pixi.toml.

Here is a detailed benchmark showing the exact time it takes: https://share.firefox.dev/4mSFnnE

@baszalmstra already communicated this should be a doable fix where it only gets initialized on first use of the client.

ruben-arts avatar Sep 12 '25 07:09 ruben-arts

To clarify we "only" need to initialize the client lazily and the gateway in the command dispatcher.

We could further improve this by also lazily initializing the client in rattler itself but I think with just the changes in pixi the situation will already improve a lot.

baszalmstra avatar Sep 12 '25 07:09 baszalmstra

could I assign this to myself? @ruben-arts ( EAFP)

nichtmacho avatar Sep 12 '25 15:09 nichtmacho