Rev 3076: Simple cleanup. in http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/patience_tuples

John Arbash Meinel john at arbash-meinel.com
Tue Dec 4 16:08:22 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/patience_tuples

------------------------------------------------------------
revno: 3076
revision-id:john at arbash-meinel.com-20071204160709-mmzmchn2daf0quma
parent: john at arbash-meinel.com-20071204152439-hlj4y6a8a2fb6nkz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: patience_tuples
timestamp: Tue 2007-12-04 10:07:09 -0600
message:
  Simple cleanup.
modified:
  bzrlib/_patiencediff_c.c       _patiencediff_c.c-20070721205602-q3imkipwlgagp3cy-1
-------------- next part --------------
=== modified file 'bzrlib/_patiencediff_c.c'
--- a/bzrlib/_patiencediff_c.c	2007-12-04 15:24:39 +0000
+++ b/bzrlib/_patiencediff_c.c	2007-12-04 16:07:09 +0000
@@ -573,17 +573,10 @@
 
     for (i = 0; i < size; i++) {
         item = PySequence_Fast_GET_ITEM(seq, i);
-        // if (!PyString_Check(item)){
-        //     PyErr_Format(PyExc_TypeError,
-        //              "sequence item %zd: expected string,"
-        //              " %.80s found",
-        //              i, item->ob_type->tp_name);
-        //     Py_DECREF(seq);
-        //     return -1;
-        // }
         if (PyString_Check(item)) {
             // we could use the 'djb2' hash here if we find it is better than
-            // PyObject_Hash
+            // PyObject_Hash, however it seems a lot slower to compute, and
+            // doesn't give particularly better results
             line->len = PyString_GET_SIZE(item);
         } else if (PyTuple_Check(item)) {
             total_len = 0;
@@ -596,15 +589,7 @@
             // Generic length
             line->len = PyObject_Length(item);
         }
-        line->data = item; //p = PyString_AS_STRING(item);
-        // /* 'djb2' hash. This gives us a nice compromise between fast hash
-        //     function and a hash with less collisions. The algorithm doesn't
-        //     use the hash for actual lookups, only for building the table
-        //     so a better hash function wouldn't bring us much benefit, but
-        //     would make this loading code slower. */
-        // h = 5381;
-        // for (j = 0; j < line->len; j++)
-        //     h = ((h << 5) + h) + *p++;
+        line->data = item;
         line->hash = PyObject_Hash(item);
         line->next = SENTINEL;
         line++;



More information about the bazaar-commits mailing list