Skip to content

Commit

Permalink
Add some logging to optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhickman committed Dec 23, 2019
1 parent 6fd6e8f commit 97cd64f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/optimize/inline_iife.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ impl Transform for InlineIife {
let changes = transform(nodes, id);
cost = 1 + cost.saturating_sub(changes);
});

log::debug!("Applied inline_iife transform. Cost: {:?}", cost);
cost
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/optimize/inline_let.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ impl Transform for InlineLet {
let changes = transform(nodes, id);
cost = 1 + cost.saturating_sub(changes);
});

log::debug!("Applied inline_let transform. Cost: {:?}", cost);
cost
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/optimize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ pub fn optimize(expr: &mut ir::Expr, opts: Opts) {
while budget != 0 {
let cost = pass.transform(expr);
budget = budget.saturating_sub(cost);
log::debug!(
"Applied optimisation pass. Total cost: {}. Remaining budget: {}",
cost,
budget
);
}
}

Expand Down

0 comments on commit 97cd64f

Please sign in to comment.