Author: eelco
Date: Thu Oct 28 12:50:01 2010
New Revision: 24513
URL: https://svn.nixos.org/websvn/nix/?rev=24513&sc=1

Log:
* new(UseGC) is inexplicably slower than GC_MALLOC, so prefer the
  latter.

Modified:
   nix/branches/gc/src/libexpr/eval.cc

Modified: nix/branches/gc/src/libexpr/eval.cc
==============================================================================
--- nix/branches/gc/src/libexpr/eval.cc Thu Oct 28 12:29:40 2010        (r24512)
+++ nix/branches/gc/src/libexpr/eval.cc Thu Oct 28 12:50:01 2010        (r24513)
@@ -259,7 +259,8 @@
     mkString(v, s.c_str());
     if (!context.empty()) {
         unsigned int n = 0;
-        v.string.context = NEW const char *[context.size() + 1];
+        v.string.context = (const char * *)
+            GC_MALLOC((context.size() + 1) * sizeof(char *));
         foreach (PathSet::const_iterator, i, context)  
             v.string.context[n++] = GC_STRDUP(i->c_str());
         v.string.context[n] = 0;
@@ -304,7 +305,7 @@
 Value * EvalState::allocValue()
 {
     nrValues++;
-    return NEW Value;
+    return (Value *) GC_MALLOC(sizeof(Value));
 }
 
 
@@ -313,7 +314,6 @@
     nrEnvs++;
     nrValuesInEnvs += size;
     Env * env = (Env *) GC_MALLOC(sizeof(Env) + size * sizeof(Value *));
-    if (!env) throw std::bad_alloc();
 
     /* Clear the values because maybeThunk() expects this. */
     for (unsigned i = 0; i < size; ++i)
@@ -335,7 +335,7 @@
 {
     v.type = tList;
     v.list.length = length;
-    v.list.elems = NEW Value *[length];
+    v.list.elems = (Value * *) GC_MALLOC(length * sizeof(Value *));
     nrListElems += length;
 }
 
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to