~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/chunk_writer.py

  • Committer: John Arbash Meinel
  • Date: 2008-08-21 19:23:46 UTC
  • mto: This revision was merged to the branch mainline in revision 3644.
  • Revision ID: john@arbash-meinel.com-20080821192346-4mtm95v5g4kkxbyu
Replace time/space benchmarks with real-world testing.
Basically, the value was overstated, because the artifical nodes
were significantly more compressible than real data.
With these results, using .copy() basically is the same time/space
trade off as allowing another repack.
1-repack + copy() is mostly equivalent to 2-repack with no copy
(in both time and space).
They generally seem to be an appropriate 'sweet spot'.
The extra pack (copy) avoids pathological behavior of not filling in
the last bytes while only adding a small overhead.
(approx 10% time cost at 20% space savings.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
        will sometimes start over and compress the whole list to get tighter
37
37
        packing. We get diminishing returns after a while, so this limits the
38
38
        number of times we will try.
39
 
        In testing, some values for 100k nodes::
40
 
 
41
 
                            w/o copy            w/ copy             w/ copy & save
42
 
            _max_repack     time    node count  time    node count  t       nc
43
 
             1               8.0s   704          8.8s   494         14.2    390 #
44
 
             2               9.2s   491          9.6s   432 #       12.9    390
45
 
             3              10.6s   430 #       10.8s   408         12.0    390
46
 
             4              12.5s   406                             12.8    390
47
 
             5              13.9s   395
48
 
            20              17.7s   390         17.8s   390
 
39
        In testing, some values for bzr.dev::
 
40
 
 
41
                    w/o copy    w/ copy     w/ copy ins w/ copy & save
 
42
            repack  time  MB    time  MB    time  MB    time  MB
 
43
             1       8.8  5.1    8.9  5.1    9.6  4.4   12.5  4.1
 
44
             2       9.6  4.4   10.1  4.3   10.4  4.2   11.1  4.1
 
45
             3      10.6  4.2   11.1  4.1   11.2  4.1   11.3  4.1
 
46
             4      12.0  4.1
 
47
             5      12.6  4.1
 
48
            20      12.9  4.1   12.2  4.1   12.3  4.1
 
49
 
 
50
        In testing, some values for mysql-unpacked::
 
51
 
 
52
                    w/o copy    w/ copy     w/ copy ins w/ copy & save
 
53
            repack  time  MB    time  MB    time  MB    time  MB
 
54
             1      56.6  16.9              60.7  14.2
 
55
             2      59.3  14.1              62.6  13.5  64.3  13.4
 
56
             3      64.4  13.5
 
57
            20      73.4  13.4
 
58
 
49
59
    :cvar _default_min_compression_size: The expected minimum compression.
50
60
        While packing nodes into the page, we won't Z_SYNC_FLUSH until we have
51
61
        received this much input data. This saves time, because we don't bloat