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 <rep...@bugs.python.org> <http://bugs.python.org/issue21100> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com