mmcv/mmcv
Andrew Stahlman cd9dcc19da
[Enhancement] Speed up Registry initialization (#1844)
* Speed up Registry initialization

This PR addresses https://github.com/open-mmlab/mmcv/issues/1843.

Instead of calling inspect.stack() to read the entire stack and its
associated source files from disk, walk up the stack to get only the
specific frame that we need (see [1] for additional information).

This makes imports in downstream projects ~2.5x faster in my local dev
environment. For mmaction2, for example:

Before:

    $ python -m timeit -n1 -r1 "from mmaction.apis import init_recognizer, inference_recognizer"
    1 loop, best of 1: 1.94 sec per loop

After:

    $ python -m timeit -n1 -r1 "from mmaction.apis import init_recognizer, inference_recognizer"
    1 loop, best of 1: 754 msec per loop

[1] https://stackoverflow.com/a/42636264/895769

* Add comment with PR tag

Explain why we avoid `inspect.stack()` with link to PR
2022-04-14 14:01:34 +08:00
..
arraymisc
cnn [Fix] GELU got an unexpected keyword argument 'inplace' (#1847) 2022-04-02 14:17:01 +08:00
engine
fileio Upgrade the version of isort (#1705) 2022-02-09 21:29:21 +08:00
image Imporve the docstring of imfrombytes and fix a deprecation-warning (#1731) 2022-02-18 16:54:19 +08:00
model_zoo
onnx Add deprecate warning of deployment (#1750) 2022-03-01 15:07:07 +08:00
ops [Enhancment] Optimize correlation op (#1814) 2022-04-10 14:38:55 +08:00
parallel [Fix] Fix _sync_params was removed in torch1.11.0 (#1816) 2022-03-26 16:19:45 +08:00
runner [Feature] Support finding free port in _init_dist_slurm() (#1846) 2022-04-09 12:53:23 +08:00
tensorrt Add deprecate warning of deployment (#1750) 2022-03-01 15:07:07 +08:00
utils [Enhancement] Speed up Registry initialization (#1844) 2022-04-14 14:01:34 +08:00
video
visualization
__init__.py
version.py bump version to v1.4.8 (#1836) 2022-03-26 16:25:59 +08:00