Rev 4770: Add a quick shortcut when comparing item-by-item. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-static-tuple-no-use
John Arbash Meinel
john at arbash-meinel.com
Mon Oct 12 19:06:06 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1-static-tuple-no-use
------------------------------------------------------------
revno: 4770
revision-id: john at arbash-meinel.com-20091012180602-1zgs701z6oj3knb3
parent: john at arbash-meinel.com-20091012180207-gqjvwo80raq23gvq
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-static-tuple-no-use
timestamp: Mon 2009-10-12 13:06:02 -0500
message:
Add a quick shortcut when comparing item-by-item.
This should help the StaticTuple_Intern() case when the items being
pointed to have also already been interned. It avoids a couple C
function calls, which isn't a huge performance hit, but it is something.
-------------- next part --------------
=== modified file 'bzrlib/_static_tuple_c.c'
--- a/bzrlib/_static_tuple_c.c 2009-10-12 18:02:07 +0000
+++ b/bzrlib/_static_tuple_c.c 2009-10-12 18:06:02 +0000
@@ -389,6 +389,10 @@
PyObject *result = NULL;
v_obj = StaticTuple_GET_ITEM(v_st, i);
w_obj = StaticTuple_GET_ITEM(w_st, i);
+ if (v_obj == w_obj) {
+ /* Shortcut case, these must be identical */
+ continue;
+ }
if (PyString_CheckExact(v_obj) && PyString_CheckExact(w_obj)) {
result = string_richcompare(v_obj, w_obj, Py_EQ);
} else if (StaticTuple_CheckExact(v_obj) &&
More information about the bazaar-commits
mailing list