[New-bugs-announce] [issue21100] Micro-optimization for tuple comparison

Raymond Hettinger report at bugs.python.org
Sun Mar 30 07:49:39 CEST 2014


New submission from Raymond Hettinger:

The tuple comparison code contains an outdated comment to the effect that testing unequal lengths for an early-out may not be worth it because it is an uncommon case in real code.

While the unequal length case remains rare, the common case code (added when rich comparisons were introduced) pays a price by not being able to assume the lengths are equal.  Adding an single early length equality test saves a repeated inner loop test for "i < wlen" and a single post-loop test for "i >= wlen".

----------
components: Interpreter Core
files: tuple_micro_optimization.diff
keywords: patch
messages: 215166
nosy: rhettinger
priority: low
severity: normal
stage: patch review
status: open
title: Micro-optimization for tuple comparison
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file34665/tuple_micro_optimization.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21100>
_______________________________________


More information about the New-bugs-announce mailing list