The idea behind priohelp in get_topo_order and gen_code was to have a point system in order to influence the order returned in get_topo_order. The "default" behaviour in get_topo_order is greedy in the sense that it gives extra points to nodes with few children (so memory is likely to be freed sooner). If a node frees memory the point is set to -Inf or NaN. Since priohelp is added to this value, and -Inf+ a is always -Inf, the priohelp does not provide as much control as it could.
Suggestion: We replace -Inf and NaN usage in get_topo_order with -free_mem_bonus and -2*free_mem_bonus where free_mem_bonus is a kwarg.
The idea behind
priohelp
inget_topo_order
andgen_code
was to have a point system in order to influence the order returned inget_topo_order
. The "default" behaviour inget_topo_order
is greedy in the sense that it gives extra points to nodes with few children (so memory is likely to be freed sooner). If a node frees memory the point is set to-Inf
orNaN
. Sincepriohelp
is added to this value, and-Inf+ a
is always-Inf
, thepriohelp
does not provide as much control as it could.Suggestion: We replace
-Inf
andNaN
usage inget_topo_order
with-free_mem_bonus
and-2*free_mem_bonus
wherefree_mem_bonus
is a kwarg.