Skip to content

Commit

Permalink
Improve performance for module query
Browse files Browse the repository at this point in the history
It improve performance when both name and stream is empty.
  • Loading branch information
j-mracek authored and kontura committed Mar 11, 2021
1 parent 943d9a1 commit 38942d4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libdnf/module/ModulePackageContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,11 @@ ModulePackageContainer::query(std::string name, std::string stream, std::string
Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
// platform modules are installed and not in modules std::Map.
query.available();
std::ostringstream ss;
ss << stringFormater(name) << ":" << stringFormater(stream);
query.addFilter(HY_PKG_DESCRIPTION, HY_GLOB, ss.str().c_str());
if (!name.empty() || !stream.empty()) {
std::ostringstream ss;
ss << stringFormater(name) << ":" << stringFormater(stream);
query.addFilter(HY_PKG_DESCRIPTION, HY_GLOB, ss.str().c_str());
}
if (!context.empty()) {
query.addFilter(HY_PKG_SUMMARY, HY_GLOB, context.c_str());
}
Expand Down

0 comments on commit 38942d4

Please sign in to comment.