[New-bugs-announce] [issue17936] O(2) behaviour when adding/removing classes

Kristján Valur Jónsson report at bugs.python.org
Wed May 8 17:58:46 CEST 2013


New submission from Kristján Valur Jónsson:

We came across this curious phenomenon, when our progam was leaking dynamically created classes.  It started spending CPU, to be fixed when gc  was increased.  The attached .py file demonstrates the problem.

The problem is due to how child classes are added to the parent class, in this case, "object".  Obsolete code tries to look for a NULL pointer in the entire list of children.

In addition, removing child classes is unnecessarily slow.

the attached patch fixes these performance issues.

----------
components: Interpreter Core
files: slowness.py
keywords: patch
messages: 188724
nosy: kristjan.jonsson
priority: normal
severity: normal
status: open
title: O(2) behaviour when adding/removing classes
type: performance
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30178/slowness.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17936>
_______________________________________


More information about the New-bugs-announce mailing list