提高IO流和zlib加快 [英] Boost IO Stream and ZLib speed up

查看:213
本文介绍了提高IO流和zlib加快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大量的数据文件,我有COM pressed与zlib的使用boost输入输出流和过滤流缓冲区:

I have a large file of data I have compressed with Zlib using boost IOStreams and filtering stream buffers:

boost::iostreams::array_source uncompressedArray( reinterpret_cast< const char* >( &uncompressedData[0] ), uncompressedData.size() );

boost::iostreams::filtering_streambuf< boost::iostreams::output > out;
out.push( *m_compressor );
out.push( boost::iostreams::char_back_inserter( compressedData ) );
boost::iostreams::copy( uncompressedArray, out );

有关速度,我初始化zlib库具有以下内容:

For speed I am initializing the zlib library with the following:

boost::iostreams::zlib_params params;
params.level = boost::iostreams__zlib::best_speed;
params.mem_level = 9;

m_compressor.reset( new boost::iostreams::zlib_compressor( params, 131072 ) );
m_decompressor.reset( new boost::iostreams::zlib_decompressor( params, 131072 ) );

我DECOM pressor看起来是这样的:

My decompressor looks like this:

boost::iostreams::array_source compressedArray( reinterpret_cast< const char* >( &compressedData[0] ), compressedData.size() );

boost::iostreams::filtering_streambuf< boost::iostreams::input > m_in;
m_in.push( *m_decompressor );
m_in.push( compressedArray );       
boost::iostreams::copy( m_in, boost::iostreams::char_back_inserter( uncompressedData ) );

我的问题是有没有我可以加快在inflate(DECOM preSS)操作的任何方式?眼下COM pression走的是我的数据访问时间约83%,我真的需要得到这个速度更快。任何建议将不胜AP preciated。

My question is are there any ways I can speed up the inflate (decompress) operation? Right now the compression is taking about 83% of my data access time and I really need to get this faster. Any suggestions would be greatly appreciated.

推荐答案

要加快DECOM pression的唯一方法是使COM pressed数据更小,所以它具有较小的处理。这意味着花更多的时间COM pressing,假设你不是因为担心在该结束的处理时间。所以,你会选择最好的COM pression。

The only way to speed up decompression is to make the compressed data smaller, so it has less to process. That means spending more time compressing, assuming that you're not as concerned about the processing time on that end. So you would select best compression.

这篇关于提高IO流和zlib加快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆