Skip to content

importing tqdm.auto is very slow due to ipython completion initialization #709

@jamescasbon

Description

@jamescasbon
  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    import tqdm, sys
    print(tqdm.__version__, sys.version, sys.platform)
$ cat i.py                                                                                                               
from tqdm.auto import trange

 $ python -m cProfile -o istats i.py
$ python -m pstats istats                                                                                                 (tge)  (2s 833ms)  
Welcome to the profile statistics browser.
istats% sort time 
istats% stats 10
Mon Apr  8 09:13:08 2019    istats

         2604401 function calls (2598194 primitive calls) in 2.625 seconds

   Ordered by: internal time
   List reduced from 3049 to 10 due to restriction <10>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    1.311    1.311    2.066    2.066 /home/james/.conda/envs/tge/lib/python3.6/site-packages/IPython/core/completer.py:103(<module>)
  1114112    0.412    0.000    0.412    0.000 {built-in method unicodedata.name}
  1114613    0.228    0.000    0.228    0.000 {built-in method builtins.chr}
      492    0.080    0.000    0.080    0.000 {built-in method marshal.loads}
1492/1489    0.045    0.000    0.171    0.000 {built-in method builtins.__build_class__}
    647/1    0.026    0.000    2.626    2.626 {built-in method builtins.exec}
     5616    0.022    0.000    0.037    0.000 <frozen importlib._bootstrap_external>:57(_path_join)
   134990    0.020    0.000    0.020    0.000 {method 'append' of 'list' objects}
     2396    0.020    0.000    0.020    0.000 {built-in method posix.stat}
      808    0.020    0.000    0.020    0.000 {built-in method __new__ of type object at 0x5629e0adae00}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions