[issue23744] Speed-up deque.__bool__

2015-03-23 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue23744] Speed-up deque.__bool__

2015-03-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset bb27dff7f83f by Raymond Hettinger in branch 'default': Issue 23744: Minor speed-up for deque.__bool__(). https://hg.python.org/cpython/rev/bb27dff7f83f -- nosy: +python-dev ___ Python tracker

[issue23744] Speed-up deque.__bool__

2015-03-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for taking a look. IMO, the cost of this one is near zero and there is a modest benefit. It is simple enough that I don't feel any angst about applying it. I'm doing several little touch-ups to the module, individually nothing, but collectively m

[issue23744] Speed-up deque.__bool__

2015-03-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: On further checking, this probably gives slightly greater benefit to deque than it would for list, tuple, dict, etc., only because PyObject_IsTrue checks for mapping before sequence; deque is a pure sequence, no mapping, so it has to fail an extra test before

[issue23744] Speed-up deque.__bool__

2015-03-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is it worth the definition of tp_as_number and maintaining another method for a micro-optimization? Presumably every collection in Python would benefit slightly from this (say, defaultdict in the same file, list, tuple, etc.), but none of them bother. Why woul

[issue23744] Speed-up deque.__bool__

2015-03-22 Thread Raymond Hettinger
Changes by Raymond Hettinger : Added file: http://bugs.python.org/file38645/timings_deque_bool.txt ___ Python tracker ___ ___ Python-bugs-list

[issue23744] Speed-up deque.__bool__

2015-03-22 Thread Raymond Hettinger
New submission from Raymond Hettinger: The __bool__ method is a little faster than __len__. Timings attached. -- assignee: rhettinger components: Library (Lib) files: deque_bool1.diff keywords: patch messages: 238983 nosy: rhettinger priority: normal severity: normal status: open title: