This is an implementation of LZW compression in Parrot assembly.  The fact
that pack() can't handle null bytes makes it a bit more complicated (and
limited) than it has to be, but for just text files, it seems to work just
fine.  It's probably a decent stress test for the hash PMC, but especially
for strings, since I probably go through more strings than I have to.

It's also good for showing interesting performance effects:

Compressing 20875 bytes: 5.3 sec
Compressing 19646 bytes: 1.4 sec

I haven't looked into exactly why, but it looks like compact_string_pool()
is going insane (see attachment).

/s

Attachment: ziptest.tgz
Description: Binary data

Smaller file:

  %   cumulative   self              self     total
 time   seconds   seconds    calls  us/call  us/call  name
 31.03      0.18     0.18      130  1384.62  1384.62  compact_string_pool
 10.34      0.24     0.06   239357     0.25     0.25  singlebyte_decode
 10.34      0.30     0.06   221558     0.27     0.27  buffer_lives
  5.17      0.33     0.03   299167     0.10     0.10  singlebyte_skip_forward
  5.17      0.36     0.03      168   178.57   535.37  mark_hash
  5.17      0.39     0.03        1 30000.00 251150.69  cg_core

Larger file:

  %   cumulative   self              self     total
 time   seconds   seconds    calls  us/call  us/call  name
 70.30      0.71     0.71      217  3271.89  3271.89  compact_string_pool
  5.94      0.77     0.06      168   357.14   475.98  mark_hash
  2.97      0.80     0.03    85754     0.35     8.74  Parrot_allocate_string
  2.97      0.83     0.03        1 30000.00 530991.70  cg_core

Reply via email to