in reply to Re: Compressing a set of integers
in thread Compressing a set of integers
I have about 50,000 numbers today, but I don't want the code to have a 16 bit limit since I expect the dataset to grow.
I want to be able to store the data with Storable, and I think that it will not support a custom Inline::C representation. If there is another high-performance way to store the data that can take advantage of Inline::C, then that would be a candidate.
My platform is somewhat crufty. It is HP-UX 10.20 for the production web server and linux as the data generator. For generality and future-proofing, I prefer portable code, but this is not a hard requirement.
So far, my main ideas are:
The larger problem is that I am investigating speed versus memory tradeoffs in on-line queries involving a many-to-many relationship. I have an *extremely* fast solution using Table::ParentChild, but it cannot be stored using the Storable module. This is because Table::ParentChild uses an XS data structure, which represents each parent-child relationship in four 32 bit integers. I can sacrifice a little speed and use less memory. To this end I have coded another very fast solution using hashes and arrays, and most of the memory it uses are in these strings of numbers. I think that the strings are still wasteful, since they represent only about 3 bits of information per digit and one bit or so of information per delimiter character.
I hope to write more about the larger problem in the future, but for now I find that the core of my solution relies on these strings of numbers. The compression problem sounded familiar, so I hoped that someone would have some ideas.
I have run across this problem before, where I wanted compression, but I have a line-oriented file and I want to be able to decompress just a single line at a time, when this line is located anywhere in the file. It seems like an ordinary problem in compression, but after searching for a few hours I didn't find anything, so I asked first in chat and then here.
Update:
I have found the classification of the larger problem
that I am working on. It is a graph problem. My graphs
are sparse and large, so I am using an adjacency list.
The sets that I am compressing are rows in the adjacency
list. This is described in chapter 8 of
Mastering Algorithms with Perl,
where the Graph modules are described.
It should work perfectly the first time! - toma
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: More details on compressing a set of integers
by BrowserUk (Patriarch) on Jan 26, 2003 at 06:48 UTC | |
by toma (Vicar) on Jan 26, 2003 at 07:08 UTC |