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 <rep...@bugs.python.org>
<http://bugs.python.org/issue17936>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to