<div dir="ltr"><div><div><br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 2, 2015 at 4:52 PM, Boris Pavlovic <span dir="ltr"><<a href="mailto:boris@pavlovic.me" target="_blank">boris@pavlovic.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi stackers,<div><br></div><div>Recently, I started working on speeding up Rally cli.</div><div><br></div><div>What I understand immediately  is that I don't understand why it takes 700-800ms</div><div>to just run "rally version" command and it is impossible hard task to find what takes so much time just by reading the code. </div><div><br></div><div>I started playing with patching __import__ and make a simple but powerful tool</div><div>that allows you to trace any imports and get pretty graphs of nested importing with timings: </div><div><br></div><div><a href="https://github.com/boris-42/profimp" target="_blank">https://github.com/boris-42/profimp</a></div><div><br></div><div>So now it's simple to understand what imports take most of time, just by running:  </div><div><br></div><div>  profimp "import <lib>" --html</div><div> </div><div><br></div><div>Let's optimize OpenStack libs and clients? </div><div><br></div><div><div><br></div><div>Best regards,</div><div>Boris Pavlovic </div></div></div>
<br></blockquote><div><br>There's a review in python-keystoneclient to do lazy importing of 
modules here: <a href="https://review.openstack.org/#/c/164066/">https://review.openstack.org/#/c/164066/</a> . 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.<br><br> - Brant <br></div></div><br></div></div>