diff options
author | Adrian Wielgosik <adrian.wielgosik@gmail.com> | 2016-02-02 18:55:48 +0100 |
---|---|---|
committer | Adrian Wielgosik <adrian.wielgosik@gmail.com> | 2016-02-02 20:51:15 +0100 |
commit | adb4f2c5cf0e313e8d39a562fe7f095d2029f647 (patch) | |
tree | 29534578b4f0af553f6a9515197de038d6aa222d | |
parent | f1828e6b0adb87bf0b99d3cfeeafbb76cbc6aab7 (diff) |
Try avoiding loading long package description
It's a fairly expensive call and it's called on every package,
even though it's usually only used when we're interested in
a small number of packages.
Long description is currently only shown by this function
when using `apt search X --full`.
On my PC, this patch speeds up `apt list` by roughly 20%
and `apt list --installed` by 1-2%.
-rw-r--r-- | apt-private/private-output.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index b8e6dec02..458d78dc4 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -290,7 +290,8 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ output = SubstVar(output, "${color:highlight}", _config->Find("APT::Color::Highlight", "")); output = SubstVar(output, "${color:neutral}", _config->Find("APT::Color::Neutral", "")); output = SubstVar(output, "${Description}", GetShortDescription(CacheFile, records, P)); - output = SubstVar(output, "${LongDescription}", GetLongDescription(CacheFile, records, P)); + if (output.find("${LongDescription}") != string::npos) + output = SubstVar(output, "${LongDescription}", GetLongDescription(CacheFile, records, P)); output = SubstVar(output, "${ }${ }", "${ }"); output = SubstVar(output, "${ }\n", "\n"); output = SubstVar(output, "${ }", " "); |