代码拉取完成,页面将自动刷新
#include <fstream>
#include <sstream>
#include "bundle.h"
#ifdef _MSC_VER
#include <omp.h>
#endif
int main(int argc, const char **argv) {
using namespace bundle;
using namespace std;
// 23 mb dataset
string original( "There's a lady who's sure all that glitters is gold" );
for (int i = 0; i < 18; ++i) original += original + string( i + 1, 32 + i );
// argument file?
if( argc > 1 ) {
ifstream ifs( argv[1], ios::binary );
stringstream ss;
ss << ifs.rdbuf();
original = ss.str();
}
// pack, unpack & verify all encoders
vector<unsigned> libs {
RAW, SHOCO, LZ4F, MINIZ, LZIP, LZMA20,
ZPAQ, LZ4, BROTLI9, ZSTD, LZMA25,
BSC, BROTLI11, SHRINKER, CSC20, BCM,
ZLING, MCM, TANGELO, ZMOLLY, CRUSH, LZJB
};
for( auto &lib : libs ) {
#ifdef _MSC_VER
double t = omp_get_wtime();
#endif
string packed = pack(lib, original);
string unpacked = unpack(packed);
cout << original.size() << " <--> " << packed.size() << " bytes (" << name_of(lib) << ")";
#ifdef _MSC_VER
cout << " " << ((omp_get_wtime() - t)*1000) << "ms.";
#endif
if( original == unpacked ) cout << endl; else cout << " (failed)" << endl;
}
cout << "All ok." << endl;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。