Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import takes 800ms due to pkg_resources #790

Closed
FabriceSalvaire opened this issue Feb 17, 2019 · 2 comments
Closed

Import takes 800ms due to pkg_resources #790

FabriceSalvaire opened this issue Feb 17, 2019 · 2 comments

Comments

@FabriceSalvaire
Copy link

Here profile of import markdown

         1234363 function calls (1229528 primitive calls) in 0.933 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    109/1    0.001    0.000    0.933    0.933 {built-in method builtins.exec}
        1    0.000    0.000    0.933    0.933 devel/profile-import.py:1(<module>)
    124/1    0.001    0.000    0.933    0.933 <frozen importlib._bootstrap>:978(_find_and_load)
    124/1    0.000    0.000    0.933    0.933 <frozen importlib._bootstrap>:948(_find_and_load_unlocked)
    118/1    0.001    0.000    0.933    0.933 <frozen importlib._bootstrap>:663(_load_unlocked)
     87/1    0.000    0.000    0.933    0.933 <frozen importlib._bootstrap_external>:722(exec_module)
    151/1    0.000    0.000    0.904    0.904 <frozen importlib._bootstrap>:211(_call_with_frames_removed)
        1    0.000    0.000    0.904    0.904 .../site-packages/markdown/__init__.py:21(<module>)
        1    0.000    0.000    0.895    0.895 .../site-packages/markdown/core.py:21(<module>)
        1    0.000    0.000    0.800    0.800 .../site-packages/pkg_resources/__init__.py:16(<module>)
        2    0.000    0.000    0.708    0.354 .../site-packages/pkg_resources/__init__.py:3174(_call_aside)
        1    0.000    0.000    0.708    0.708 .../site-packages/pkg_resources/__init__.py:3191(_initialize_master_working_set)
       36    0.003    0.000    0.452    0.013 .../site-packages/pkg_resources/__init__.py:611(add_entry)
     2760    0.006    0.000    0.428    0.000 .../site-packages/pkg_resources/__init__.py:2005(find_on_path)
      454    0.000    0.000    0.256    0.001 .../site-packages/pkg_resources/__init__.py:3218(<genexpr>)
      453    0.002    0.000    0.255    0.001 .../site-packages/pkg_resources/__init__.py:2717(activate)
     3297    0.010    0.000    0.232    0.000 .../site-packages/pkg_resources/__init__.py:2159(_handle_ns)
        1    0.000    0.000    0.231    0.231 .../site-packages/pkg_resources/__init__.py:569(_build_master)
        1    0.000    0.000    0.230    0.230 .../site-packages/pkg_resources/__init__.py:556(__init__)
      453    0.002    0.000    0.228    0.001 .../site-packages/pkg_resources/__init__.py:2258(fixup_namespace_packages)
     5420    0.013    0.000    0.203    0.000 .../site-packages/pkg_resources/__init__.py:2092(distributions_from_metadata)
     3287    0.005    0.000    0.199    0.000 <frozen importlib._bootstrap_external>:421(_find_module_shim)
       18    0.000    0.000    0.199    0.011 .../site-packages/pkg_resources/__init__.py:1979(_by_version_descending)
       18    0.010    0.001    0.199    0.011 {built-in method builtins.sorted}
     3732    0.042    0.000    0.195    0.000 <frozen importlib._bootstrap_external>:1356(find_spec)
     3287    0.002    0.000    0.185    0.000 <frozen importlib._bootstrap_external>:1339(find_loader)
     2710    0.005    0.000    0.145    0.000 .../site-packages/pkg_resources/__init__.py:1994(_by_version)
     2710    0.005    0.000    0.130    0.000 .../site-packages/pkg_resources/__init__.py:2000(<listcomp>)
     2726    0.013    0.000    0.128    0.000 .../site-packages/pkg_resources/__init__.py:2546(from_location)
     8240    0.009    0.000    0.125    0.000 .../site-packages/pkg_resources/_vendor/packaging/version.py:24(parse)
    11080    0.046    0.000    0.112    0.000 .../site-packages/pkg_resources/_vendor/packaging/version.py:198(__init__)
       87    0.001    0.000    0.112    0.001 <frozen importlib._bootstrap_external>:793(get_code)
    35/19    0.000    0.000    0.100    0.005 {built-in method builtins.__import__}
@FabriceSalvaire
Copy link
Author

pkg_resources import should be move to core.py:Markdown.build_extension

@waylan
Copy link
Member

waylan commented Feb 17, 2019

PRs are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants