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

Robert Collins robertc at robertcollins.net
Tue May 5 00:17:19 UTC 2015


On 7 April 2015 at 10:43, Robert Collins <robertc at robertcollins.net> wrote:

>> $ time openstack -h
>> <snip>
>> real    0m2.491s
>> user    0m2.378s
>> sys     0m0.111s
>
>
> pbr should be snappy - taking 100ms to get the version is wrong.

I've now tested this.
With an egg-info present in a git tree:
python -m timeit -n 1 -r 1 -s "import pbr.version"
"pbr.version.VersionInfo('testtools').semantic_version()"
1 loops, best of 1: 166 usec per loop

Without an egg-info present in a git tree:
python -m timeit -n 1 -r 1 -s "import pbr.version"
"pbr.version.VersionInfo('testtools').semantic_version()"
1 loops, best of 1: 254 msec per loop

Installed:
python -m timeit -n 1 -r 1 -s "import pbr.version"
"pbr.version.VersionInfo('testtools').semantic_version()"
1 loops, best of 1: 189 usec per loop

So: the 200s case occurs when:
 - you're running out of git
 - have not built an egg_info

This is precisely the case where pkg_resources lookups cannot work,
and we are falling back to git. Its also the case where not using pbr
would result in no version being available and an error or $whatnot.

>From this I conclude that the tests testing performance are not
representative of end user experience - because we expect end users to
be running installed trees (either via "pip install -e ." [which also
creates an egg-info directory] or "pip install $projectname" or
"apt-get/yum/etc install $projectname"). I don't know what other
things may be wrong with the measurement environment, but we should
fix them so that we can be confident what we change matters.

-Rob

-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud



More information about the OpenStack-dev mailing list