forked from lix-project/lix
libstore: keep Goal errors as unique_ptrs
Error is pretty large, and most goals do not fail. this alone more than
halves the size of Goal on x86_64-linux, from 720 bytes down to 344. in
derived classes the difference is not as dramatic, but even the largest
derived class (`LocalDerivationGoal`) loses almost 20% of its footprint
Change-Id: Ifda8f94c81b6566eeb3e52d55d9796ec40c7bce8
This commit is contained in:
parent
7bf1aff44a
commit
472ff1b833
|
@ -22,7 +22,7 @@ void Store::buildPaths(const std::vector<DerivedPath> & reqs, BuildMode buildMod
|
||||||
if (ex)
|
if (ex)
|
||||||
logError(i->ex->info());
|
logError(i->ex->info());
|
||||||
else
|
else
|
||||||
ex = std::move(i->ex);
|
ex = std::move(*i->ex);
|
||||||
}
|
}
|
||||||
if (i->exitCode != Goal::ecSuccess) {
|
if (i->exitCode != Goal::ecSuccess) {
|
||||||
if (auto i2 = dynamic_cast<DerivationGoal *>(i.get()))
|
if (auto i2 = dynamic_cast<DerivationGoal *>(i.get()))
|
||||||
|
|
|
@ -78,7 +78,7 @@ void Goal::amDone(ExitCode result, std::optional<Error> ex)
|
||||||
if (!waiters.empty())
|
if (!waiters.empty())
|
||||||
logError(ex->info());
|
logError(ex->info());
|
||||||
else
|
else
|
||||||
this->ex = std::move(*ex);
|
this->ex = std::make_unique<Error>(std::move(*ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & i : waiters) {
|
for (auto & i : waiters) {
|
||||||
|
|
|
@ -121,7 +121,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Exception containing an error message, if any.
|
* Exception containing an error message, if any.
|
||||||
*/
|
*/
|
||||||
std::optional<Error> ex;
|
std::unique_ptr<Error> ex;
|
||||||
|
|
||||||
Goal(Worker & worker, DerivedPath path)
|
Goal(Worker & worker, DerivedPath path)
|
||||||
: worker(worker)
|
: worker(worker)
|
||||||
|
|
Loading…
Reference in a new issue