* Turned the msg() and debug() functions into macros, since they
turned out to be a huge performance bottleneck (the text to printed would always be evaluated, even when it was above the verbosity level). This reduces fix-ng execution time by over 50%. gprof(1) is very useful. :-)
This commit is contained in:
parent
d2e3a132fe
commit
15801c88fa
10 changed files with 60 additions and 45 deletions
|
|
@ -23,7 +23,6 @@ static Expr substArgs(Expr body, ATermList formals, Expr arg)
|
|||
while (!ATisEmpty(formals)) {
|
||||
ATerm t = ATgetFirst(formals);
|
||||
Expr name, def;
|
||||
debug(printTerm(t));
|
||||
if (ATmatch(t, "NoDefFormal(<term>)", &name))
|
||||
subs.set(name, undefined);
|
||||
else if (ATmatch(t, "DefFormal(<term>, <term>)", &name, &def))
|
||||
|
|
@ -234,7 +233,8 @@ Expr evalExpr2(EvalState & state, Expr e)
|
|||
|
||||
Expr evalExpr(EvalState & state, Expr e)
|
||||
{
|
||||
Nest nest(lvlVomit, format("evaluating expression: %1%") % printTerm(e));
|
||||
startNest(nest, lvlVomit,
|
||||
format("evaluating expression: %1%") % printTerm(e));
|
||||
|
||||
state.nrEvaluated++;
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ Expr evalExpr(EvalState & state, Expr e)
|
|||
|
||||
Expr evalFile(EvalState & state, const Path & path)
|
||||
{
|
||||
Nest nest(lvlTalkative, format("evaluating file `%1%'") % path);
|
||||
startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path);
|
||||
Expr e = parseExprFromFile(path);
|
||||
return evalExpr(state, e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static Expr evalExpr2(EvalState & state, Expr e)
|
|||
|
||||
static Expr evalStdin(EvalState & state)
|
||||
{
|
||||
Nest nest(lvlTalkative, format("evaluating standard input"));
|
||||
startNest(nest, lvlTalkative, format("evaluating standard input"));
|
||||
Expr e = ATreadFromFile(stdin);
|
||||
if (!e)
|
||||
throw Error(format("unable to read a term from stdin"));
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ static Path copyAtom(EvalState & state, const Path & srcPath)
|
|||
Path drvPath = writeTerm(unparseNixExpr(ne), "");
|
||||
state.drvHashes[drvPath] = drvHash;
|
||||
|
||||
msg(lvlChatty, format("copied `%1%' -> closure `%2%'")
|
||||
printMsg(lvlChatty, format("copied `%1%' -> closure `%2%'")
|
||||
% srcPath % drvPath);
|
||||
return drvPath;
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ static string processBinding(EvalState & state, Expr e, NixExpr & ne)
|
|||
string s;
|
||||
bool first = true;
|
||||
while (!ATisEmpty(es)) {
|
||||
Nest nest(lvlVomit, format("processing list element"));
|
||||
startNest(nest, lvlVomit, format("processing list element"));
|
||||
if (!first) s = s + " "; else first = false;
|
||||
s += processBinding(state, evalExpr(state, ATgetFirst(es)), ne);
|
||||
es = ATgetNext(es);
|
||||
|
|
@ -123,7 +123,7 @@ static string processBinding(EvalState & state, Expr e, NixExpr & ne)
|
|||
|
||||
Expr primDerivation(EvalState & state, Expr args)
|
||||
{
|
||||
Nest nest(lvlVomit, "evaluating derivation");
|
||||
startNest(nest, lvlVomit, "evaluating derivation");
|
||||
|
||||
ATermMap attrs;
|
||||
args = evalExpr(state, args);
|
||||
|
|
@ -143,7 +143,7 @@ Expr primDerivation(EvalState & state, Expr args)
|
|||
{
|
||||
string key = aterm2String(ATgetFirst(keys));
|
||||
Expr value = attrs.get(key);
|
||||
Nest nest(lvlVomit, format("processing attribute `%1%'") % key);
|
||||
startNest(nest, lvlVomit, format("processing attribute `%1%'") % key);
|
||||
|
||||
/* The `args' attribute is special: it supplies the
|
||||
command-line arguments to the builder. */
|
||||
|
|
@ -199,7 +199,7 @@ Expr primDerivation(EvalState & state, Expr args)
|
|||
Path drvPath = writeTerm(unparseNixExpr(ne), "-d-" + drvName);
|
||||
state.drvHashes[drvPath] = drvHash;
|
||||
|
||||
msg(lvlChatty, format("instantiated `%1%' -> `%2%'")
|
||||
printMsg(lvlChatty, format("instantiated `%1%' -> `%2%'")
|
||||
% drvName % drvPath);
|
||||
|
||||
attrs.set("outPath", ATmake("Path(<str>)", outPath.c_str()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue