Skip to content

First run of Unitxt after install is slow #1496

@yoavkatz

Description

@yoavkatz

It takes over 30 seconds for unitxt to run after first install:

conda create -n unitxt2 python=3.10
conda activate unitxt2
python -m cProfile -s cumtime examples/qa_evaluation.py

  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      192    0.019    0.000  132.975    0.693 __init__.py:1(<module>)
       13    0.000    0.000   40.048    3.081 api.py:1(<module>)
   2492/1    0.083    0.000   32.400   32.400 {built-in method builtins.exec}
        1    0.000    0.000   32.400   32.400 qa_evaluation.py:1(<module>)
   1862/1    0.009    0.000   32.381   32.381 <frozen importlib._bootstrap>:1022(_find_and_load)
   1742/1    0.006    0.000   32.381   32.381 <frozen importlib._bootstrap>:987(_find_and_load_unlocked)
   1667/1    0.008    0.000   32.380   32.380 <frozen importlib._bootstrap>:664(_load_unlocked)
   1450/1    0.003    0.000   32.380   32.380 <frozen importlib._bootstrap_external>:877(exec_module)
   2283/1    0.002    0.000   32.380   32.380 <frozen importlib._bootstrap>:233(_call_with_frames_removed)
1667/1655    0.004    0.000   30.633    0.019 <frozen importlib._bootstrap>:564(module_from_spec)
  210/207    0.002    0.000   30.584    0.148 <frozen importlib._bootstrap_external>:1174(create_module)
  210/207   30.559    0.146   30.580    0.148 {built-in method _imp.create_dynamic}
  735/193    0.001    0.000   22.587    0.117 {built-in method builtins.__import__}
 1745/836    0.003    0.000   20.420    0.024 <frozen importlib._bootstrap>:1053(_handle_fromlist)
        1    0.000    0.000   16.150   16.150 card.py:1(<module>)
        1    0.000    0.000   16.093   16.093 task.py:1(<module>)
        1    0.000    0.000   16.050   16.050 metrics.py:1(<module>)
        1    0.000    0.000   14.487   14.487 arrow_dataset.py:1(<module>)
        1    0.000    0.000   14.277   14.277 _stats_py.py:1(<module>)
  210/169    0.001    0.000    6.719    0.040 <frozen importlib._bootstrap_external>:1182(exec_module)
  210/169    0.083    0.000    6.718    0.040 {built-in method _imp.exec_dynamic}
  143/136    0.000    0.000    6.655    0.049 __init__.py:108(import_module)
  143/136    0.000    0.000    6.655    0.049 <frozen importlib._bootstrap>:1038(_gcd_import)
35797/31732    0.006    0.000    6.630    0.000 {built-in method builtins.hasattr}
    32/30    0.000    0.000    5.863    0.195 __init__.py:132(__getattr__)
        1    0.000    0.000    3.403    3.403 distributions.py:1(<module>)
        1    0.000    0.000    3.337    3.337 _laplacian.py:1(<module>)
        1    0.000    0.000    2.525    2.525 arrow_reader.py:1(<module>)
        3    0.000    0.000    2.372    0.791 generic.py:1(<module>)
        1    0.000    0.000    2.031    2.031 _continuous_distns.py:1(<module>)
        1    0.000    0.000    1.845    1.845 _geometric_slerp.py:1(<module>)
        1    0.000    0.000    1.844    1.844 distance.py:1(<module>)
        1    0.000    0.000    1.793    1.793 iterative.py:1(<module>)
        1    0.000    0.000    1.702    1.702 pyarrow.py:1(<module>)
        1    0.000    0.000    1.598    1.598 inspect.py:1(<module>)
        1    0.000    0.000    1.598    1.598 load.py:1(<module>)
       10    0.000    0.000    1.553    0.155 __init__.py:326(__getattr__)
        1    0.000    0.000    1.407    1.407 download_manager.py:1(<module>)
        2    0.000    0.000    1.404    0.702 parquet.py:1(<module>)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions