Rev 102: 'bzr pack' _FAST during compress() now is 32s versus 25s. in http://bazaar.launchpad.net/%7Ebzr/bzr-groupcompress/rabin

John Arbash Meinel john at arbash-meinel.com
Tue Mar 3 22:27:28 GMT 2009


At http://bazaar.launchpad.net/%7Ebzr/bzr-groupcompress/rabin

------------------------------------------------------------
revno: 102
revision-id: john at arbash-meinel.com-20090303222649-n917r5v7ti7szu5r
parent: john at arbash-meinel.com-20090303221259-ghe53xhqu8igvz03
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: rabin
timestamp: Tue 2009-03-03 16:26:49 -0600
message:
  'bzr pack' _FAST during compress() now is 32s versus 25s.
  However, I'm extending _FAST to also stop checking the sha1 sums,
  with that change, _FAST is 20s versus 32s.
  It is a bit dangerous without the sha1 checking, but it is nice
  to see as a 'how fast can we make it', once we are sure about
  correctness.
-------------- next part --------------
=== modified file 'groupcompress.py'
--- a/groupcompress.py	2009-03-03 22:12:59 +0000
+++ b/groupcompress.py	2009-03-03 22:26:49 +0000
@@ -53,7 +53,7 @@
     )
 
 _NO_LABELS = False
-_FAST = False
+_FAST = True
 
 def parse(bytes):
     if _NO_LABELS:
@@ -153,7 +153,10 @@
         # TODO: Change this to a bytes interface, since the output is now a
         #       bytes interface anyway.
         bytes = ''.join(chunks)
-        sha1 = sha_string(bytes)
+        if not _FAST or expected_sha is None:
+            sha1 = sha_string(bytes)
+        else:
+            sha1 = expected_sha
         if key[-1] is None:
             key = key[:-1] + ('sha1:' + sha1,)
         label = '\x00'.join(key)
@@ -540,7 +543,7 @@
                 if _NO_LABELS:
                     sha1 = sha_strings(chunks)
                 else:
-                    if sha_strings(chunks) != sha1:
+                    if not _FAST and sha_strings(chunks) != sha1:
                         raise AssertionError('sha1 sum did not match')
             yield ChunkedContentFactory(key, parents, sha1, chunks)
 



More information about the bazaar-commits mailing list