Commit Graph

4710 Commits

Author SHA1 Message Date
Tim Peters
1544fc5312 Various clarifications based on feedback & questions over the years. 2013-08-24 15:31:07 -05:00
Tim Peters
ec8147ba55 Various clarifications based on feedback & questions over the years.
(grafted from 23181bf411a16287a0a54e910fc0f9ecd2764bf0)
2013-08-24 15:15:19 -05:00
Antoine Pitrou
9d95254bb7 Issue #18772: fix the gdb plugin after the set implementation changes 2013-08-24 21:07:07 +02:00
Antoine Pitrou
91541931f5 Back out 5bd9db528aed (issue #18408). It caused unsolved buildbot failures. 2013-08-23 23:18:20 +02:00
Raymond Hettinger
bfc1e1a9cd Add the same dummy type that is used in dictionaries. 2013-08-23 03:22:15 -05:00
Tim Peters
a1db94554b Add line explaining the "%sort" test. 2013-08-22 18:42:02 -05:00
Tim Peters
01e75a699d Add line explaining the "%sort" test.
(grafted from 1ea833ecaf5a9d43a886e9e73b4e2551d0d5b548)
2013-08-22 18:32:53 -05:00
Raymond Hettinger
fcf3b500ba Issue 18797: Remove unneeded refcount adjustments for dummy objects.
It suffices to keep just one reference when the object is created.
2013-08-22 08:20:31 -07:00
Raymond Hettinger
5bb1b1dd6f Hoist the global dummy lookup out of the inner loop for set_merge(). 2013-08-21 01:34:18 -07:00
Raymond Hettinger
929cbac307 Remove a redundant hash table probe (this was artifact from an earlier draft of the patch). 2013-08-20 23:03:28 -07:00
Raymond Hettinger
ae9e616a00 Issue 18772: Restore set dummy object back to unicode and restore the identity checks in lookkey().
The Gdb prettyprint plugin depended on the dummy object being displayable.
Other solutions besides a unicode object are possible.  For now, get it
back up and running.

The identity checks in lookkey() need to be there to prevent the dummy
object from leaking through Py_RichCompareBool() into user code in the
rare circumstance where the dummy's hash value exactly matches the hash
value of the actual key being looked up.
2013-08-20 22:28:24 -07:00
Raymond Hettinger
3c0a4f5def Issue18771: Reduce the cost of hash collisions for set objects. 2013-08-19 07:36:04 -07:00
Raymond Hettinger
07351a0449 Remove the else-clause because the conditions are no longer mutually exclusive. 2013-08-17 02:39:46 -07:00
Raymond Hettinger
237b34b074 Use a known unique object for the dummy entry.
This lets us run PyObject_RichCompareBool() without
first needing to check whether the entry is a dummy.
2013-08-17 02:31:53 -07:00
Serhiy Storchaka
8fa8ee3970 Issue #18701: Remove support of old CPython versions (<3.0) from C code. 2013-08-17 00:48:02 +03:00
Raymond Hettinger
8ad3919577 Hoist the global "dummy" lookup outside of the reinsertion loop. 2013-08-15 02:18:55 -07:00
Raymond Hettinger
d06eeb4a24 merge 2013-08-13 18:20:55 -07:00
Raymond Hettinger
b1b915c796 Issue 18719: Remove a false optimization
Remove an unused early-out test from the critical path for
dict and set lookups.

When the strings already have matching lengths, kinds, and hashes,
there is no additional information gained by checking the first
characters (the probability of a mismatch is already known to
be less than 1 in 2**64).
2013-08-13 18:16:34 -07:00
Antoine Pitrou
9ed5f27266 Issue #18722: Remove uses of the "register" keyword in C code. 2013-08-13 20:18:52 +02:00
Raymond Hettinger
c629d4c9a2 Replace outdated optimization with clearer code that compiles better.
Letting the compiler decide how to optimize the multiply by five
gives it the freedom to make better choices for the best technique
for a given target machine.

For example, GCC on x86_64 produces a little bit better code:

Old-way (3 steps with a data dependency between each step):

    shrq    $5, %r13
    leaq    1(%rbx,%r13), %rax
    leaq    (%rax,%rbx,4), %rbx

New-way (3 steps with no dependency between the first two steps
         which can be run in parallel):

    leaq    (%rbx,%rbx,4), %rax     # i*5
    shrq    $5, %r13                # perturb >>= PERTURB_SHIFT
    leaq    1(%r13,%rax), %rbx      # 1 + perturb + i*5
2013-08-05 22:24:50 -07:00
Antoine Pitrou
58720d6145 Issue #17934: Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles. 2013-08-05 23:26:40 +02:00
Raymond Hettinger
c86d7e989c Silence compiler warning for an unused declaration 2013-08-04 12:00:36 -07:00
Raymond Hettinger
e56666d17f Silence compiler warning about an uninitialized variable 2013-08-04 11:51:03 -07:00
Raymond Hettinger
5ed1b38a7d merge 2013-08-04 11:51:35 -07:00
Serhiy Storchaka
579ddc2fd4 Issue #16741: Fix an error reporting in int(). 2013-08-03 21:14:05 +03:00