mirror of
https://github.com/QuasarApp/LIEF.git
synced 2025-04-28 05:14:33 +00:00
Use ifstream::read method to read file data instead of std::copy.
Improves the time to load and parse a large executable (~100MB) on my machine from ~1000ms to ~400ms.
This commit is contained in:
parent
a26ae60e83
commit
89bd542833
@ -38,11 +38,7 @@ VectorStream::VectorStream(const std::string& filename) {
|
||||
|
||||
// reserve capacity
|
||||
this->binary_.resize(this->size() + 30, 0);
|
||||
std::copy(
|
||||
std::istreambuf_iterator<char>(binary),
|
||||
std::istreambuf_iterator<char>(),
|
||||
std::begin(this->binary_)
|
||||
);
|
||||
binary.read(reinterpret_cast<char*>(binary_.data()), this->size_);
|
||||
binary.close();
|
||||
} else {
|
||||
throw LIEF::bad_file("Unable to open " + filename);
|
||||
|
Loading…
x
Reference in New Issue
Block a user