'Performance of Python binary from a Conda environemnt - it is slower than my local python installation (Windows) or python from Poetry env

When I run the same python script (internally it submits gRPC requests to a server process running on the same machine as a separate binary) using two python3 binaries installed from different sources (one from Conda, one installed by Scoop) I get very different performance - it's 10x slower when using python executable from Conda environment.

Setup

  • Create a Conda environment: conda create -c conda-forge -n MyEnv python=3.10.2 grpcio=1.44.0 protobuf=3.19.4.
  • Activate the environment: conda activate MyEnv

Results

  • When I start my python script using python from conda env: python my_script.py the script runs slowly (100 gRPC requests per second). python --version is Python 3.10.2.
  • Using my local python install I get 10x better performance (1000 requests per second). python --version is Python 3.10.2 as well.
  • Using python binary from Poetry env I also get 10x better performance (1000 requests per second). python --version is Python 3.10.2 as well.

Question

What can be causing the speed difference? Some flags python was compiled with? I looked at the python binaries and they're very different size-wise.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source