Commit Graph

47 Commits

Author SHA1 Message Date
Martin Panter
cda80940ed Issue #15984: Merge PyUnicode doc from 3.5 2016-04-15 02:27:11 +00:00
Martin Panter
6245cb3c01 Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Raymond Hettinger
2300bf29e6 Only update the arr variable when PyObject_RichCompareBool() has been called. 2015-12-07 20:45:16 -08:00
Raymond Hettinger
cfe5b6ca04 Divisions-by-two for a positive Py_ssize_t compile more cleanly with >>1 than /2. 2015-07-20 00:25:50 -04:00
Raymond Hettinger
5cbd8331ff Issue #24221: Small optimizations for heapq.
Replaces the PyList_GET_ITEM and PyList_SET_ITEM macros with normal array
accesses.  Replace the siftup unpredicatable branch with arithmetic.
Replace the rc == -1 tests with rc < 0.  Gives nicer looking assembly
with both Clang and GCC-4.9.  Also gives a small performance both for both.
2015-05-22 00:41:57 -07:00
Raymond Hettinger
c784c6db60 Tighten-up code by eliminating an unnecessary variable. 2015-05-15 21:01:13 -07:00
Raymond Hettinger
d69755d1a3 Minor code clean-up. 2015-05-15 17:53:52 -07:00
Raymond Hettinger
636488043b More timings suggest that 2500 is closer to the break-even point. 2015-05-12 21:40:50 -07:00
Raymond Hettinger
4e6bf4b3da merge 2015-05-11 19:59:21 -07:00
Raymond Hettinger
b9db9e152f Defend against a mutation during comparison 2015-05-11 19:58:56 -07:00
Raymond Hettinger
99bf9a2567 Minor code cleanups. 2015-05-11 19:25:32 -07:00
Raymond Hettinger
a032e46df6 Minor stylistic clean-up. 2015-05-11 10:32:57 -07:00
Raymond Hettinger
bc33e57d56 Issue #24155: Optimize heapify for better cache utililzation. 2015-05-11 10:19:03 -07:00
Raymond Hettinger
1dd8e71eb3 Issues #24099, #24100, and #24101: Fix free-after-use bug in heapq. 2015-05-02 10:00:22 -07:00
Raymond Hettinger
48f68d00b8 Factor common code into internal functions.
Clean-up names of static functions.
Use Py_RETURN_NONE macro.
Expose private functions needed to support merge().
Move C imports to the bottom of the Python file.
2014-06-14 16:43:35 -07:00
Raymond Hettinger
234fb2d503 Issue 21424: Apply the nlargest() optimizations to nsmallest() as well. 2014-05-11 14:21:23 -07:00
Raymond Hettinger
277842eff1 Issue #21424: Optimize heaqp.nlargest() to make fewer tuple comparisons.
Consolidates the logic for nlargest() into a single function so that
decoration tuples (elem,order) or (key, order, elem) only need to
be formed when a new element is added to the heap.  Formerly, a tuple
was created for every element regardless of whether it was added to
the heap.

The change reduces the number of tuples created, the number of ordering
integers created, and total number of tuple comparisons.
2014-05-11 01:55:46 -07:00
Raymond Hettinger
90e9338383 Neaten-up a bit add add missing size change check. 2014-05-03 18:45:54 -07:00
Raymond Hettinger
871620d951 Simplify and speedup the internals of the heapq module. 2014-05-03 18:36:48 -07:00
Raymond Hettinger
c9926088dd Issue 21375: Fix possible Py_ssizet overflow in heapq. 2014-05-03 15:22:07 -07:00
Victor Stinner
764a46d2ed Issue #18408: Fix heapq.heappop(), handle PyList_SetSlice() failure 2013-07-17 21:50:21 +02:00
Terry Jan Reedy
09b7503bc9 Merge 3.2, Issue #17047: remove doubled words found in 2.7 to 3.4
Modules/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:45:12 -04:00
Terry Jan Reedy
0158af38b7 Issue #17047: remove doubled words found in 2.7 to 3.4 Modules/*,
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:42:46 -04:00
Antoine Pitrou
31584e30ab Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. 2013-03-04 20:33:36 +01:00
Antoine Pitrou
44d5214927 Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. 2013-03-04 20:30:01 +01:00