DataSet 或任何 .Net 对象的压缩/解压缩

发布于 2024-10-17 18:09:39 字数 285 浏览 5 评论 0原文

我正在开发一个 WPF 应用程序,我想在其中加密和压缩重型数据集或对象(<2MB)并通过网络发送它。对方将数据解压、解密并消费。这个过程将在服务器(WCF)到客户端以及客户端到服务器的两侧进行。

  1. 我想要高效的压缩类(想坚持使用 .Net 压缩类)。
  2. 压缩和解压缩所需的时间更少。
  3. 压缩率高,数据检索应为100%。

任何人都可以建议我有关压缩类(DeflateStream/GzipStream)的信息。

谢谢
维杰

I'm developing a WPF App, in which I want to encrypt and compress heavy DataSet or Objects (<2MB) and send it across over the network. The other party would decompress and decrypt the data and consume it. This process will be on both sides from Server(WCF) to Client and Client to Server.

  1. I want efficient Compression Class (would like to stick to .Net compression classes).
  2. Takes less time to compress and decompress.
  3. compress ratio high while data retrieval should be 100%.

Can anyone suggest me about the compression classes (DeflateStream/GzipStream).

Thanks
VJ

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

宣告ˉ结束 2024-10-24 18:09:39

大多数人混淆“压缩的最终大小”==“更好的网络性能”。一般来说,使用“优于 deflate”类压缩算法可以减少传输带宽,但会增加总传输时间(压缩+传输+解压缩)。从这个意义上说,LZ 级压缩机似乎是最好的。最快的实施方式可以是 QuickLZLZ4.它们都有 C# 版本。但是,它们的实现并不完全像 Def​​lateStream(实际上使用起来更简单)。 QuickLZ 在网络相关应用程序中的使用量不断增加,而 LZ4 最近修补到了 Apache Hadoop 源主干,而不是 Google 的 Snappy。

如果您需要更多压缩,可以获取 LZMA SDK,其中包含托管 LZMA 压缩/解压缩方法。但是,我应该警告你,LZMA 的内存消耗通常非常高(取决于参数)。因此,生成多个 LZMA 支持的线程不太可能是您真正想要的。

如果您仍然需要越来越多的压缩,请查看 PPM 或按位 CM 类算法。 PPM 非常适合文本数据,并且具有平均速度(通常为 2-3 MiB/秒)。另一方面,CM 对于二进制数据非常擅长。它们的内存消耗可能很高(取决于参数)并且非常慢(1 MiB/秒甚至几个字节/秒,取决于算法)。不幸的是,您可能只能在互联网上找到 PPM .NET 实现。但是,由于复杂性太高,在.NET中寻找CM确实很麻烦。我在.NET中编写了 order0 按位编码器如果您确实需要,可以使用其他模型将其扩展为适当的 CM。

Most people confuses "compressed final size" == "better network performance". In general sense, using "better-than-deflate" class compression algorithms can reduce transfer bandwidth, but they can increase total transfer time (compression+transfer+decompression). In that sense LZ class compressor seems best. Fastest implementation can be QuickLZ or LZ4. They both have a C# version. But, their implementation is not exactly as e.g. DeflateStream (actually simplier to use). QuickLZ has growing usage on network related applications while LZ4 patched into Apache Hadoop source trunk recently instead of Google's Snappy.

If you need more compression, you can grab LZMA SDK which consists of managed LZMA compression/decompression methods. But, I should warn you, LZMA's memory consumption is usually very high (depends on parameters). So, spawning several LZMA-powered threads is not likely you really want.

If you still need more and more compression, have a look at PPM or bitwise-CM class algorithms. PPM is very good on textual data and has an average speed (usually 2-3 MiB/sec). On the other hand, CM is very good on binary data. Their memory consumption can be high (depends on parameters) and very slow (1 MiB/sec to even several bytes/sec, depends on algorithms). Unfortunately, you may only find PPM .NET implementation on the internet. But, CM is really troublesome to find in .NET due to high complexity. I have written order0 bitwise coder in .NET that can be extended to a proper CM with additional models if you really need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文