diff options
-rw-r--r-- | src/crates/candelabra/src/profiler/info.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/crates/candelabra/src/profiler/info.rs b/src/crates/candelabra/src/profiler/info.rs index cde1e2c..78ce299 100644 --- a/src/crates/candelabra/src/profiler/info.rs +++ b/src/crates/candelabra/src/profiler/info.rs @@ -108,12 +108,10 @@ impl UsageProfile { // calculate cost of switching let before = &top_by_partition[0].0; let after = &top_by_partition[split_idx].0; - let before_model = candidates.get(before).unwrap(); - let after_model = candidates.get(after).unwrap(); let copy_n = self.0[split_idx].avg_n; - let switching_cost = after_model.by_op.get("insert")?.estimatef(copy_n) - + before_model.by_op.get("clear")?.estimatef(copy_n); + let after_model = candidates.get(after).unwrap(); + let switching_cost = copy_n * after_model.by_op.get("insert")?.estimatef(copy_n / 2.0); // see if it's "worth it" let before_costs = &costs_by_partitions @@ -141,7 +139,7 @@ impl UsageProfile { threshold: copy_n as usize, after: after.to_string(), }, - top_by_partition.iter().map(|(_, v)| v).sum(), + top_by_partition.iter().map(|(_, v)| v).sum::<f64>() + switching_cost, )) } } |