From e74a2940522e37d63043f662f38fba3620c01780 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 14 Aug 2015 21:13:49 -0700 Subject: 2000 - stop constantly copying large arrays around --- 020run.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to '020run.cc') 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 > 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 > 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. -- cgit 1.4.1-2-gfad0