[MERGE] Btree index updates
Robert Collins
robertc at robertcollins.net
Thu Aug 28 02:15:16 BST 2008
On Mon, 2008-08-25 at 20:07 -0500, John Arbash Meinel wrote:
> === modified file 'bzrlib/chunk_writer.py'
> --- bzrlib/chunk_writer.py 2008-08-22 02:09:36 +0000
> +++ bzrlib/chunk_writer.py 2008-08-26 00:42:07 +0000
> @@ -20,6 +20,10 @@
> import zlib
> from zlib import Z_FINISH, Z_SYNC_FLUSH
>
> +# [max_repack, buffer_full, repacks_with_space, min_compression,
> +# total_bytes_in, total_bytes_out, avg_comp,
> +# bytes_autopack, bytes_sync_packed, num_full_by_zsync]
> +_stats = [0, 0, 0, 999, 0, 0, 0, 0, 0, 0]
Do we need global state for this? I'd rather have a callback or
something that can be used for instrumentation.
> class ChunkWriter(object):
> """ChunkWriter allows writing of compressed data with a fixed
> size.
> @@ -38,34 +42,55 @@
> number of times we will try.
> In testing, some values for bzr.dev::
> 2 54.4 13.7 3467 0 35.4
> + 20 67.0 13.4 0 3380 46.7
I'd rather have the performance details in comments than docstrings;
docstrings are the how-to-use documentation and the performance details
really aren't helpful with that. In fact, I think it hurts because its
not prose and readers don't know how much to skip.
>
> def finish(self):
> """Finish the chunk.
> @@ -97,11 +125,22 @@
> out = self.compressor.flush(Z_FINISH)
> self.bytes_list.append(out)
> self.bytes_out_len += len(out)
If you seed self.seen_bytes as 0.0, it will stay as a float and you
won't need to cast. Might be faster - or slower :P.
bb:tweak
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080828/b6d75944/attachment.pgp
More information about the bazaar
mailing list