the python apport hook slows down startup time of the python interpreter by 50%

Bug #1307684 reported by Matthias Klose
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

the python apport hook slows down startup time of the python interpreter by 50%. This is caused by always importing the re and the glob modules (and depending modules). Now moving the import into the functions.

As a future optimization, maybe don't use the re module at all in enabled().

Found by investigating a failing test in the python3 testsuite.

Martin Pitt (pitti)
Changed in apport (Ubuntu):
status: New → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks Matthias for finding this, that's a nice optimization!

I rejected your upload as it introduces a regression, spotted by pyflakes:

./apport_python_hook.py:159: undefined name 're'

I fixed that and applied it to trunk:

  http://bazaar.launchpad.net/~apport-hackers/apport/trunk/revision/2787

Revision history for this message
Martin Pitt (pitti) wrote :

Re-uploaded to trusty-proposed queue.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.14.1-0ubuntu3

---------------
apport (2.14.1-0ubuntu3) trusty; urgency=medium

  * Cherry-pick from trunk: Delay the import of the glob and re modules in the
    python apport hook, and only import them when needed. Speeds up
    interpreter startup time by 50%. (LP: #1307684)
 -- Matthias Klose <email address hidden> Tue, 15 Apr 2014 08:42:00 +0200

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.