Commit b4bae394 authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: small optimisation in Cluster.collapseFailures

This makes fewer temporary data structures, and thus brings a bit of
improvement in total runtime.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent 8f48f67d
......@@ -603,7 +603,8 @@ tryBalance ini_tbl disk_moves inst_moves evac_mode mg_limit min_gain =
-- | Build failure stats out of a list of failures.
collapseFailures :: [FailMode] -> FailStats
collapseFailures flst =
map (\k -> (k, length $ filter (k ==) flst)) [minBound..maxBound]
map (\k -> (k, foldl' (\a e -> if e == k then a + 1 else a) 0 flst))
-- | Update current Allocation solution and failure stats with new
-- elements.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment