Commit Graph

62 Commits

Author SHA1 Message Date
Benjamin Peterson
f30bad284b remove some copyright notices supserseded by the toplevel ones 2016-01-01 11:53:47 -06:00
Serhiy Storchaka
c06a6d0958 Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:07:48 +02:00
Raymond Hettinger
f358d2b244 Second instance of deque needing "len" instead of "Py_SIZE" in Py2.7 2015-11-12 18:20:21 -08:00
Raymond Hettinger
3a75403880 Deque uses "len" instead of varhead in Py2.7 2015-11-12 07:18:45 -08:00
Raymond Hettinger
e904427285 Backport early-out 91259f061cfb to reduce the cost of bb1a2944bcb6 2015-10-06 23:12:02 -04:00
Raymond Hettinger
d2a4073db2 Issue #25135: Avoid possible reentrancy issues in deque_clear. 2015-09-26 00:52:57 -07:00
Raymond Hettinger
fe13eac341 Issue #19663: Improve error message for defaultdict. 2015-07-20 03:08:09 -04:00
Benjamin Peterson
5863a39603 deque is not varsized, so using Py_SIZE is nonsensical (closes #24162) 2015-05-15 12:19:18 -04:00
Raymond Hettinger
79f2c5b8e0 Defer deleted item decref until after the deque is restored to a consistent state. 2015-05-02 10:53:27 -07:00
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