Skip to content

Slow import time #289

@disconnect3d

Description

@disconnect3d

Hi,

The import time of ipdb is super slow. It would be awesome if we can get it improved as it is a bit embarassing that importing ipdb is ~6x slower than pdb (on intel mac; and I have seen it being even slower on a Linux VPS, like 0.5s vs 0.01s).

Below is a quick benchmark of it:

$ pip freeze
pytasttokens==2.4.1
decorator==5.1.1
executing==2.1.0
ipdb==0.13.13
ipython==8.29.0
jedi==0.19.2
matplotlib-inline==0.1.7
parso==0.8.4
pexpect==4.9.0
prompt_toolkit==3.0.48
ptyprocess==0.7.0
pure_eval==0.2.3
Pygments==2.18.0
six==1.16.0
stack-data==0.6.3
traitlets==5.14.3
wcwidth==0.2.13

$ python --version
Python 3.12.7

$ cat import-pdb.py
import pdb

$ cat import-ipdb.py
import ipdb

$ hyperfine "python import-pdb.py"
Benchmark 1: python import-pdb.py
  Time (mean ± σ):      75.4 ms ±   3.8 ms    [User: 49.0 ms, System: 17.1 ms]
  Range (min … max):    69.6 ms …  90.4 ms    33 runs

$ hyperfine "python import-ipdb.py"
Benchmark 1: python import-ipdb.py
  Time (mean ± σ):     422.4 ms ±  22.4 ms    [User: 321.4 ms, System: 82.2 ms]
  Range (min … max):   402.2 ms … 470.4 ms    10 runs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions