简体   繁体   English

具有恒定时间寻找特定字节的压缩算法?

[英]Compression Algorithms with Constant-Time Seek to Specific Byte?

I'm experimenting with building a data-structure optimized for a very specific use-case.我正在尝试构建针对特定用例优化的数据结构。 Essentially, I am trying to build a compressed bitset of a constant size, and obviously for that use-case, two operations exist: read the value of a bit or write the value of a bit.本质上,我正在尝试构建一个恒定大小的压缩位集,显然对于该用例,存在两个操作:读取位的值或写入位的值。

The best case scenario would be to be able to read a byte and write a byte in-place in constant time, but I can't imagine that it would be possible to write to an arbitrary byte without making changes to the rest of the compressed chunk of memory.最好的情况是能够在恒定时间内读取一个字节并就地写入一个字节,但我无法想象在不更改压缩文件的 rest 的情况下可以写入任意字节memory 块。 However, it might be possible to read an arbitrary byte in an amount of time that tends toward O(1).但是,有可能在接近 O(1) 的时间内读取任意字节。

I have been reading Wikipedia articles, and I'm familiar with LZO, but is there a table somewhere which describes the various features and tradeoffs that various compression systems provide?我一直在阅读 Wikipedia 文章,并且我对 LZO 很熟悉,但是否有一个表格描述了各种压缩系统提供的各种功能和权衡? I'd like a moderate level of compression, and I'm mainly wanting to optimize around memory holes, eg large gaps of bytes which are zeroes.我想要中等程度的压缩,我主要想围绕 memory 孔进行优化,例如零字节的大间隙。

Assuming that you are doing many of these random accesses, you can build an index (once) to a compressed stream to get O(1).假设您正在执行许多这些随机访问,您可以为压缩的 stream 构建索引(一次)以获得 O(1)。 Here is an example for gzip streams .这是gzip 流的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM