[issue4174] Performance optimization for min() and max() over lists

2010-02-22 Thread A.M. Kuchling
A.M. Kuchling li...@amk.ca added the comment: Should this patch just be rejected, then? Or is the more general locking suggested in msg88021 of interest? -- nosy: +akuchling ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4174

[issue4174] Performance optimization for min() and max() over lists

2010-02-22 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I agree that the performance improvement isn't worth the extra code, or the risk of introducing bugs (the comments so far show that it's not trivial to get this right). Closing as rejected. -- nosy: +mark.dickinson resolution: -

[issue4174] Performance optimization for min() and max() over lists

2010-02-22 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I think the patch should just be rejected. Workloads where min() / max() performance is a bottleneck have to be very rare. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4174

[issue4174] Performance optimization for min() and max() over lists

2009-05-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: Perhaps not. I had however written a general list locking system, generalizing the way sort() locks a list for direct manipulation, and rewritten min and max to be able to use that. Perhaps that approach would be of interest?

[issue4174] Performance optimization for min() and max() over lists

2009-05-20 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I am with Raymond here: I don't think the performance improvement would be worth a significant complification of the code - unless the improvement is /very/ large. -- ___ Python tracker

[issue4174] Performance optimization for min() and max() over lists

2009-05-15 Thread Daniel Diniz
Daniel Diniz aja...@gmail.com added the comment: Given the drawbacks mentioned (and the fact that the current patch would break when the list mutates under its feet), is this still valid? -- nosy: +ajaksu2 stage: - test needed ___ Python tracker

[issue4174] Performance optimization for min() and max() over lists

2009-01-29 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4174 ___ ___ Python-bugs-list mailing list

[issue4174] Performance optimization for min() and max() over lists

2009-01-29 Thread David W. Lambert
Changes by David W. Lambert lamber...@corning.com: ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4174 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue4174] Performance optimization for min() and max() over lists

2009-01-29 Thread David W. Lambert
Changes by David W. Lambert lamber...@corning.com: ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4174 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue4174] Performance optimization for min() and max() over lists

2008-10-23 Thread Hrvoje Nikšić
Hrvoje Nikšić [EMAIL PROTECTED] added the comment: Note that the item retrieved by PyList_GET_ITEM must be increffed before being passed to the function. Otherwise mutating the list can remove the item from the list and destroy the underlying object, in which case the current maxitem can refer

[issue4174] Performance optimization for min() and max() over lists

2008-10-22 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson [EMAIL PROTECTED]: This adds a special case for min() and max() when iterating over lists. For simple lists of floats, the improvement is some 15% on a windows machine using release build (non pgo) -- components: Interpreter Core files:

[issue4174] Performance optimization for min() and max() over lists

2008-10-22 Thread Antoine Pitrou
Antoine Pitrou [EMAIL PROTECTED] added the comment: I haven't tried the patch as is but I can spot two problems: - you should use PyList_CheckExact instead of PyList_Check, because a list subclass could override __getitem__ - when keyfunc is not NULL, you can't assume that the list size will

[issue4174] Performance optimization for min() and max() over lists

2008-10-22 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: Not that excited about adding this much code for such a small speedup. Also, the list can change size during iteration so the for-loop needs to be changed to: for(i = 1; iPyList_GET_SIZE(v); i++) -- priority: - low

[issue4174] Performance optimization for min() and max() over lists

2008-10-22 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: Antoine, the list can mutate even when the keyfunc is NULL. The rich comparison can callback to arbitrary Python code. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4174

[issue4174] Performance optimization for min() and max() over lists

2008-10-22 Thread Antoine Pitrou
Antoine Pitrou [EMAIL PROTECTED] added the comment: Antoine, the list can mutate even when the keyfunc is NULL. The rich comparison can callback to arbitrary Python code. Ouch, you are right. ___ Python tracker [EMAIL PROTECTED]