Closed as not planned
Description
Random thought I had:
Many strings in CPython are hashed, and their hashes are stored in the string object iself so they don't have to re-computed.
We can make use of those hashes to compare strings.
So
s1 == s2
will fail in O(1)
time if their hashes are not equal. Else even if their hashes are equal we have to do a full comparison in case of hash collision.
This shouldn't require much more code, but it also shouldn't move pyperformance. I just thought it would be interesting. Thoughts anyone?
Metadata
Metadata
Assignees
Labels
No labels