about summary refs log tree commit diff stats
path: root/020run.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-14 21:13:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-14 21:13:49 -0700
commite74a2940522e37d63043f662f38fba3620c01780 (patch)
tree6c296cdb2948693d346e70d4f511f5c081eb526c /020run.cc
parentc062021a34efd1816f8595dc7426c54b9dd3258b (diff)
downloadmu-e74a2940522e37d63043f662f38fba3620c01780.tar.gz
2000 - stop constantly copying large arrays around
Diffstat (limited to '020run.cc')
-rw-r--r--020run.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/020run.cc b/020run.cc
index 504dca88..b0cf644e 100644
--- a/020run.cc
+++ b/020run.cc
@@ -71,10 +71,12 @@ void run_current_routine()
     // Each ingredient loads a vector of values rather than a single value; mu
     // permits operating on reagents spanning multiple locations.
     vector<vector<double> > ingredients;
-    for (long long int i = 0; i < SIZE(current_instruction().ingredients); ++i) {
-      ingredients.push_back(read_memory(current_instruction().ingredients.at(i)));
-      Locations_read[current_recipe_name()] += SIZE(ingredients.back());
-      Locations_read_by_instruction[current_instruction().name] += SIZE(ingredients.back());
+    if (should_copy_ingredients()) {
+      for (long long int i = 0; i < SIZE(current_instruction().ingredients); ++i) {
+        ingredients.push_back(read_memory(current_instruction().ingredients.at(i)));
+        Locations_read[current_recipe_name()] += SIZE(ingredients.back());
+        Locations_read_by_instruction[current_instruction().name] += SIZE(ingredients.back());
+      }
     }
     // Instructions below will write to 'products'.
     vector<vector<double> > products;
@@ -118,6 +120,11 @@ void run_current_routine()
   stop_running_current_routine:;
 }
 
+bool should_copy_ingredients() {
+  // End should_copy_ingredients Special-cases
+  return true;
+}
+
 //: Some helpers.
 //: We'll need to override these later as we change the definition of routine.
 //: Important that they return referrences into the routine.