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

Bug #1307684 reported by Matthias Klose on 2014-04-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
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) on 2014-04-15
Changed in apport (Ubuntu):
status: New → Fix Committed
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

Martin Pitt (pitti) wrote :

Re-uploaded to trusty-proposed queue.

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  Edit
Everyone can see this information.

Other bug subscribers