[openstack-dev] [all][oslo][clients] Let's speed up start of OpenStack libs and clients by optimizing imports with profimp

Monty Taylor mordred at inaugust.com
Thu Apr 2 23:44:33 UTC 2015


On 04/02/2015 06:22 PM, Brant Knudson wrote:
> On Thu, Apr 2, 2015 at 4:52 PM, Boris Pavlovic <boris at pavlovic.me> wrote:
> 
>> Hi stackers,
>>
>> Recently, I started working on speeding up Rally cli.
>>
>> What I understand immediately  is that I don't understand why it takes
>> 700-800ms
>> to just run "rally version" command and it is impossible hard task to find
>> what takes so much time just by reading the code.
>>
>> I started playing with patching __import__ and make a simple but powerful
>> tool
>> that allows you to trace any imports and get pretty graphs of nested
>> importing with timings:
>>
>> https://github.com/boris-42/profimp
>>
>> So now it's simple to understand what imports take most of time, just by
>> running:
>>
>>   profimp "import <lib>" --html
>>
>>
>> Let's optimize OpenStack libs and clients?
>>
>>
>> Best regards,
>> Boris Pavlovic
>>
>>
> There's a review in python-keystoneclient to do lazy importing of modules
> here: https://review.openstack.org/#/c/164066/ . It would be interesting to
> know if this improves the initial import time significantly. Also, this can
> be an example of how to improve other libraries.

Yes please.

Also - for libraries - let's try to not import lots of things.




More information about the OpenStack-dev mailing list