python-dependency-injector icon indicating copy to clipboard operation
python-dependency-injector copied to clipboard

wiring.register_loader_containers() performance

Open rmk135 opened this issue 4 years ago • 0 comments

Thanks, @rmk135. I managed to get it work with some refactoring. The issue was not related to spawn but Gunicorn.

I found out that the performance of a CLI tool we built using dependency-injector became significantly slower after using register_loader_containers. The code seems to perform a wire operation on each module import. Is the performance degradation expected?

CLI timing with wire: bentoml list 1.81s user 0.59s system 128% cpu 1.866 total bentoml list 1.82s user 0.55s system 129% cpu 1.835 total bentoml list 1.79s user 0.53s system 129% cpu 1.797 total

CLI timing with register_loader_containers: bentoml list 4.17s user 0.53s system 114% cpu 4.117 total bentoml list 4.14s user 0.51s system 116% cpu 4.001 total bentoml list 4.13s user 0.51s system 116% cpu 3.982 total

Originally posted by @ssheng in https://github.com/ets-labs/python-dependency-injector/issues/441#issuecomment-834186355


Need to check if there is a way to make a performance optimization for wiring. register_loader_containers(). Also need to keep question #437 in the context.

rmk135 avatar Jun 13 '21 19:06 rmk135