C ++ what compression library in memory?

I have already searched for compression in memory and found many libraries that offer this functionality. zlib seems to be widely used, but it also seems pretty old. I ask if there are new, better alternatives.

The data that I want to compress in memory is a few megabytes (2-16 MB) memory pools, and each of these blocks contains data from two different structures, as well as some pointer arrays. inside blocks there is no special order for structures and arrays, they simply stand out after another when the application should create such an element.

What compression lib would you suggest for this? compression and decompression performance (both) are more important than compression quality.

Also - for compression reasons - would it be better to have separate pools for two different structures as well as arrays, so that each data block that needs to be compressed contains only one kind of data?

This is the first time I intend to use compression in memory, and I know that my question may be too general to give a good answer, but every hint is welcome!

THX!

+5
source share
6 answers

zlib is good. Verified, fulfilled, and understood by many. This is what I used by default in the new system, like what you are describing. His age should be regarded as one of his greatest assets.

+9
source

- , zlib, libbzip2 . zlib . , .

- , zlib ( ..) LZO.

+3

. , , . , , , , .

, , . , , , . , , , , , - . , , .

, OOM, 64- .

+1

/, zlib... zlib , . zlib deflateInit() , , , , .

, API- API- ++, API- zlib C, - ""... , .

0

Data is important for compression. Compressing arbitrary binary data in memory is a complete waste of time, significantly slowing down your performance and probably ultimately making your memory usage higher.

If you really need to have much more memory, you should look at using VirtualAlloc or sbrk to manage memory yourself. Thus, you can address ALL physical memory, not just 2-4gb.

0
source

All Articles