[New-bugs-announce] [issue24681] Put most likely test first is set_add_entry()

Raymond Hettinger report at bugs.python.org
Wed Jul 22 06:01:49 CEST 2015


New submission from Raymond Hettinger:

Since the *found_active* exit is like the *found_error* exit in that it makes no further use of *entry*, it can be moved before the table/entry_key check whose purpose is to make sure the *entry* pointer is still valid.  This change doesn't apply to lookkey() which makes downstream use of the entry pointer.  In constrast, set_add_entry() is fully self-contained now and only returns a 0 or -1 rather than a pointer into the set table.

This puts the most likely test case first, putting it ahead of the two memory reloads in table/entry_key check.

Also, add an "else if" to the initial freeslot check to make it match the corresponding "else if" in the linear probe loop.

----------
assignee: serhiy.storchaka
components: Interpreter Core
files: better_test_order.diff
keywords: patch
messages: 247086
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Put most likely test first is set_add_entry()
versions: Python 3.6
Added file: http://bugs.python.org/file39972/better_test_order.diff

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


More information about the New-bugs-announce mailing list