Bug 713927

Summary: RFE: Reduce startup time for "large" code bases
Product: [Fedora] Fedora Reporter: James Antill <james.antill>
Component: python2Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: bkabrda, cstratak, dmalcolm, ivazqueznet, jonathansteffan, jzeleny, mhroncok, pviktori, rkuska, tomspur, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-07 11:26:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description James Antill 2011-06-16 19:22:51 UTC
Description of problem:

 Here is that bug you asked for ... basically certain yum operations are now fast enough that the python startup time hurts us quite a lot:


% time sudo yum list installed yum --color=off
Loaded plugins: PT, aliases, auto-update-debuginfo, keys, noop, ps, security,
              : tmprepo, updater, verify, versionlock
Installed Packages
yum.noarch                   3.4.1-4.fc15                    @fedora-yum-rawhide
sudo yum list installed yum --color=off  0.18s user 0.05s system 95% cpu 0.236 total
% time python -c 'import yum'
python -c 'import yum'  0.12s user 0.03s system 97% cpu 0.155 total
% time python -c 'pass'
python -c 'pass'  0.02s user 0.01s system 91% cpu 0.040 total

...as I said, from the simple tests I'd done this seemed to be a python thing and not a yum thing ... as creating a single python file of 30k lines (that did no operations) took roughly the same amount of time for python to init.

Comment 1 James Antill 2012-07-05 16:17:31 UTC
Yeh, so, I didn't include a simpler test case (so it makes it hard to test pypy or py3k until yum works on either of those). So here:

% cat pyinitspd.py
class Foo:

  def blah(): return

% for i in $(seq 30000); echo -e "  def spdtst$i(): return" >> pyinittst.py   
% wc -l pyinitspd.py
30004 pyinitspd.py

% time python -c 'import pyinitspd'
python -c 'import pyinitspd'  0.60s user 0.06s system 97% cpu 0.670 total

# This builds the .pyc file too.

% time python -c 'import pyinitspd'
python -c 'import pyinitspd'  0.14s user 0.03s system 98% cpu 0.171 total

# This is a little slower than import yum, but meh.

Comment 2 James Antill 2012-07-05 16:19:35 UTC
 Amusingly, converting to "Foo(object)" class drops the time by 0.01 ... and this is repeatable.

Comment 3 Fedora Admin XMLRPC Client 2013-05-10 04:58:26 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora Admin XMLRPC Client 2015-05-12 12:01:48 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora Admin XMLRPC Client 2016-01-29 13:04:50 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora Admin XMLRPC Client 2017-01-10 18:48:45 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 7 Petr Viktorin 2017-08-07 11:26:29 UTC
This is a long-term goal upstream, and they're slowly working at it.
Expect improvements in python3.