about summary refs log tree commit diff
path: root/src/fix/fix.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-09T10·35+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-09T10·35+0000
commit15801c88fad38253b19ac2ea77e7597deab5fd6b (patch)
tree2dab8ab76792328b6c5376509d6b2e659ad19cf8 /src/fix/fix.cc
parentd2e3a132fe6796b2ac038ccb20e7aa32afc1a85f (diff)
* 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. :-)

Diffstat (limited to 'src/fix/fix.cc')
-rw-r--r--src/fix/fix.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fix/fix.cc b/src/fix/fix.cc
index 9a8ff1513042..d75e26b00930 100644
--- a/src/fix/fix.cc
+++ b/src/fix/fix.cc
@@ -273,7 +273,7 @@ static Expr evalExpr2(EvalState & state, Expr e)
         Path pkgPath = writeTerm(unparseNixExpr(ne), "");
         state.pkgHashes[pkgPath] = pkgHash;
 
-        msg(lvlChatty, format("copied `%1%' -> closure `%2%'")
+        printMsg(lvlChatty, format("copied `%1%' -> closure `%2%'")
             % srcPath % pkgPath);
 
         return ATmake("NixExpr(<str>)", pkgPath.c_str());
@@ -362,7 +362,7 @@ static Expr evalExpr2(EvalState & state, Expr e)
         Path pkgPath = writeTerm(unparseNixExpr(ne), "-d-" + name);
         state.pkgHashes[pkgPath] = pkgHash;
 
-        msg(lvlChatty, format("instantiated `%1%' -> `%2%'")
+        printMsg(lvlChatty, format("instantiated `%1%' -> `%2%'")
             % name % pkgPath);
 
         return ATmake("NixExpr(<str>)", pkgPath.c_str());
@@ -383,7 +383,8 @@ static Expr evalExpr2(EvalState & state, Expr e)
 
 static Expr evalExpr(EvalState & state, Expr e)
 {
-    Nest nest(lvlVomit, format("evaluating expression: %1%") % printTerm(e));
+    startNest(nest, lvlVomit,
+        format("evaluating expression: %1%") % printTerm(e));
 
     /* Consult the memo table to quickly get the normal form of
        previously evaluated expressions. */
@@ -405,7 +406,7 @@ static Expr evalExpr(EvalState & state, Expr e)
 static Expr evalFile(EvalState & state, const Path & relPath)
 {
     Path path = searchPath(state.searchDirs, relPath);
-    Nest nest(lvlTalkative, format("evaluating file `%1%'") % path);
+    startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path);
     Expr e = ATreadFromNamedFile(path.c_str());
     if (!e) 
         throw Error(format("unable to read a term from `%1%'") % path);
@@ -415,7 +416,7 @@ static Expr evalFile(EvalState & state, const Path & relPath)
 
 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"));