Skip to content

BitArchiveReader extractTo memory slow than extractTo Dir #303

@Changeyuy

Description

@Changeyuy

在使用bit7z库时 遇到一个问题 当我使用BitArchiveReader类进行内存解压时, 在一些7z大文件上要比直接解压到磁盘上慢很多。

When using the bit7z library, I encountered a problem. When I use the BitArchiveReader class for memory decompression, it is much slower on some large 7z files compared to decompressing directly to disk.

try {
using namespace bit7z;
const tstring lib_path = "./7z.so";
Bit7zLibrary lib{lib_path};
BitArchiveReader reader{lib, "bigfile.7z", BitFormat::SevenZip};
vector item_info = reader.items();
for(uint32_t i=0;i<item_info.size();i++) {
if(item_info[i].isDir()) {
continue;
}
std::cout << item_info[i].index() << '\n';
std::cout << item_info[i].nativePath() << std::endl;
std::cout << item_info[i].name() << std::endl;
std::cout << item_info[i].size() << std::endl;
std::cout << std::endl;

  std::vector<unsigned char> buffer;
  reader.extractTo(buffer, i);
}

} catch ( const bit7z::BitException& ex ) {
if(ex.code() == std::errc::operation_not_permitted) {
std::cout << ex.posixCode() << std::endl;
}
std::cout << ex.what() << std::endl;
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions