[Python-Dev] PEP 509: Add a private version to dict (original) (raw)
Victor Stinner victor.stinner at gmail.com
Tue Jan 12 09:25:22 EST 2016
- Previous message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Well, it was just a remark.
2016-01-12 0:35 GMT+01:00 Andrew Barnert <abarnert at yahoo.com>:
Are you saying that d[key] = d[key] may or may not increment the version, so any optimizer can't rely on the fact that it doesn't?
Optimizers don't have to rely on this exactly behaviour. Not incrementing the version on such case avoids dictionary lookups in the guard.
My current patch does not increment if the value is the same, and I'm unable to see any performance regression on micro benchmarks: https://bugs.python.org/issue26058
So I'm in favor of making guards as efficient as possible and not increment the version in dict ;-)
Victor
- Previous message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Next message (by thread): [Python-Dev] PEP 509: Add a private version to dict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]