• 0 Posts
  • 4 Comments
Joined 3 years ago
cake
Cake day: July 1st, 2023

help-circle


  • Recently had to develop a Python project, the tests took at least ten seconds to start each single time. This is while I made over a hundred tests for my module and re-ran them after every change.

    Python is dog slow, but if your tests are taking 10 seconds to start (not even run!), then something is catastrophically wrong with your setup. For comparison, for one of my projects, it takes a total of 12 seconds to run nox on a clean slate, which involves setting up venvs for five major versions of Python, installing the package and its dependencies in each, and finally running the 1500 test test-suite five times


  • What about the fact that runtime startup alone auto-disqualifies python for all short-lived process use-cases?

    While Python’s start-up time is a lot slower than a corresponding compiled program, in most cases it’s not slow enough to matter even if the process itself is short-lived:

    $ hyperfine 'python3 -c "pass"'
    Benchmark 1: python3 -c "pass" (412 runs)
                    mean     ±       σ          min     …     max
      Wall Time      7.1 ms  ±     0.2 ms       6.7 ms  …     8.4 ms
      Memory         9.4 MiB ±     0.1 MiB      9.1 MiB …     9.5 MiB
    

    If you are running a small program so often that this kind of start-up time matters, then the loop should probably already be implemented in the program itself. In line with the article’s thesis