Created
August 20, 2020 00:12
-
-
Save wimglenn/c3565a1c2d09bf2670b8c78088b2f02e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# timing of pkgutil and importlib.resources loaders from https://github.com/wimglenn/resources-example | |
# Python 3.8.5 on linux | |
>>> from myapp.example2 import func as pkgutil_loader | |
>>> from myapp.example4 import func as importlib_resources_loader | |
>>> timeit importlib_resources_loader() | |
392 µs ± 329 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each) | |
>>> timeit pkgutil_loader() | |
200 µs ± 230 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each) | |
>>> timeit importlib_resources_loader() | |
391 µs ± 733 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each) | |
>>> timeit pkgutil_loader() | |
200 µs ± 423 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment