Skip to content

Commit

Permalink
BasisImporter,CgltfImporter: don't zero-init the arrays before a copy.
Browse files Browse the repository at this point in the history
This basically makes the copy twice as slow. Can be quite significant,
especially with large files.
  • Loading branch information
mosra committed Oct 25, 2021
1 parent 7a1b1a8 commit 809fc18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/MagnumPlugins/BasisImporter/BasisImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void BasisImporter::doOpenData(Containers::Array<char>&& data, DataFlags dataFla
if(dataFlags & (DataFlag::Owned|DataFlag::ExternallyOwned)) {
_state->in = std::move(data);
} else {
_state->in = Containers::Array<char>{data.size()};
_state->in = Containers::Array<char>{NoInit, data.size()};
Utility::copy(data, _state->in);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/MagnumPlugins/CgltfImporter/CgltfImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ void CgltfImporter::doOpenData(Containers::Array<char>&& data, const DataFlags d
if(dataFlags & (DataFlag::Owned|DataFlag::ExternallyOwned)) {
_d->fileData = std::move(data);
} else {
_d->fileData = Containers::Array<char>{data.size()};
_d->fileData = Containers::Array<char>{NoInit, data.size()};
Utility::copy(data, _d->fileData);
}

Expand Down

0 comments on commit 809fc18

Please sign in to comment.