Commit Graph

53 Commits

Author SHA1 Message Date
Benjamin Peterson
06e486c2d3 correct defaultdict signature in docstring (closes #20250)
Patch from Andrew Barnert.
2014-01-13 23:56:05 -05:00
Raymond Hettinger
662908b5e5 Restore the data block size to 62.
The former block size traded away good fit within cache lines in
order to gain faster division in deque_item().  However, compilers
are getting smarter and can now replace the slow division operation
with a fast integer multiply and right shift.  Accordingly, it makes
sense to go back to a size that lets blocks neatly fill entire
cache-lines.

GCC-4.8 and CLANG 4.0 both compute "x // 62" with something
roughly equivalent to "x * 9520900167075897609 >> 69".
2013-07-28 02:34:42 -07:00
Raymond Hettinger
b77ed2c54b Backport c952f3d122ae: Tweak the deque struct by moving the least used fields
(maxlen and weakref) to the end.
2013-07-16 02:34:19 -07:00
Raymond Hettinger
90180c1c3f Move the leftlink to the end of the block structure.
The current pattern of memory access will update both the leftlink and
rightlink at the same time, so they should be positioned side-by-side
for better cache locality.

Keeping the leftlink at the front of the structure would make sense
only if the paired updates were eliminated by backporting changesets
49a9c734304d, 3555cc0ca35b, ae9ee46bd471, and 744dd749e25b.  However,
that isn't likely to happen, so we're better off with the leftlink at
the end of the structure.
2013-07-16 01:59:30 -07:00
Benjamin Peterson
73d6aca5d2 reapply f1dc30a1be72 2013-06-25 11:35:44 -07:00
Benjamin Peterson
227f0faed2 reapply 5accb0ac8bfb 2013-06-25 11:34:48 -07:00
Benjamin Peterson
3968e29959 reapply f1dc30a1be72 2013-06-25 11:26:20 -07:00
Benjamin Peterson
13dd1f947e reapply f1dc30a1be72 2013-06-25 11:25:26 -07:00
Benjamin Peterson
478b08ee5a also backout f1dc30a1be72 for not being a bugfix 2013-06-23 11:38:11 -07:00
Benjamin Peterson
10c74d28e4 backout 5accb0ac8bfb; needs more discussion on python-dev 2013-06-22 11:16:36 -07:00
Raymond Hettinger
22b4b4cef4 Arrange structure to match the common access patterns. 2013-06-22 00:51:01 -07:00
Raymond Hettinger
03512c18cb Fix comment blocks. Adjust blocksize to a power-of-two for better divmod computations. 2013-06-14 01:06:33 -04:00
Raymond Hettinger
6688bdbe77 Minor cleanups. 2013-02-09 18:55:44 -05:00
Raymond Hettinger
426453282c Issue 16398: Use memcpy() in deque.rotate(). 2013-02-02 10:23:37 -08:00
Benjamin Peterson
40056de9f5 make deque_clear void, since it's infallible 2013-01-12 21:22:18 -05:00
Raymond Hettinger
2cdb6435d6 Issue #16398: Optimize deque.rotate() 2013-01-12 00:05:00 -08:00
Andrew Svetlov
227f59b29c Fix docstring for deque ctor to mark iterable parameter optional 2012-10-31 11:50:00 +02:00
Jesus Cea
d4e58dc966 Closes #15469: Correct __sizeof__ support for deque 2012-08-03 14:48:23 +02:00
Antoine Pitrou
c39cd783fb Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
2012-02-15 02:42:46 +01:00
Raymond Hettinger
db9d64b367 Issue 11713: clarify docstring for collections.deque() 2011-03-29 17:28:25 -07:00
Raymond Hettinger
57a8689b55 Issue 11004: Fix edge case for deque.count(). 2011-01-25 21:43:29 +00:00
Antoine Pitrou
c83ea137d7 Untabify C files. Will watch buildbots. 2010-05-09 14:46:46 +00:00
Raymond Hettinger
5f516edd77 Add count() method to collections.deque(). 2010-04-03 18:10:37 +00:00
Raymond Hettinger
a5fd24e97d Add a reverse() method to collections.deque(). 2009-12-10 06:42:54 +00:00
Raymond Hettinger
0b3263b073 Fix variants of deque.extend: d.extend(d) d+=d d.extendleft(d) 2009-12-10 06:00:33 +00:00