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%.
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, "${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, "${ }", " ");
output = SubstVar(output, "${ }${ }", "${ }");
output = SubstVar(output, "${ }\n", "\n");
output = SubstVar(output, "${ }", " ");