mirror of https://github.com/open-mmlab/mmcv.git
* 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 |
||
---|---|---|
.. | ||
arraymisc | ||
cnn | ||
engine | ||
fileio | ||
image | ||
model_zoo | ||
onnx | ||
ops | ||
parallel | ||
runner | ||
tensorrt | ||
utils | ||
video | ||
visualization | ||
__init__.py | ||
version.py |