in reply to Re^2: Byte allign compression in Perl..
in thread Byte allign compression in Perl..
Not quite. In this example the data is a stream of fixed witdth 4 byte ints. To serialise we do 2 things: 1) set the MSB on the doc_id int and 2)ensure that the pos int DOES NOT have the MSB set. To deserialise we read each 4 byte int, see if the MSB is set (if so we have a doc_id), or not set (if not set it is a pos). The data looks like:
MSBdoc_id1 pos1 pos2...posN MSBdoc_id2 pos1 pos2...posN MSBdoc_id3 blah
You can make this work with gamma encoding but as noted the gamma encoding compression algorithm uses more space than a 4 byte int if the numbers to be encoded exceed a 2 byte int. As it says in the blurb it is good for encoding small ints only. The saving directly relates to how small the ints are. If they are really small it is worth doing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Byte allign compression in Perl..
by MimisIVI (Acolyte) on Apr 11, 2008 at 17:51 UTC | |
by tachyon-II (Chaplain) on Apr 11, 2008 at 19:11 UTC | |
by tachyon-II (Chaplain) on Apr 12, 2008 at 03:43 UTC | |
by BrowserUk (Patriarch) on Apr 12, 2008 at 04:37 UTC | |
by tachyon-II (Chaplain) on Apr 12, 2008 at 06:23 UTC | |
by BrowserUk (Patriarch) on Apr 13, 2008 at 10:00 UTC | |
|