routing: make log in findPath hot path use logClosure

It generates heap allocations for it's params even if it won't end up
using them.

Reduces memory usage by 2mb
This commit is contained in:
Juan Pablo Civile 2019-08-03 23:01:16 -03:00
parent a469d5dc2c
commit 5389161162

@ -448,8 +448,11 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
fromVertex, toNode, amountToSend,
)
log.Tracef("path finding probability: fromnode=%v, tonode=%v, "+
"probability=%v", fromVertex, toNode, edgeProbability)
log.Trace(newLogClosure(func() string {
return fmt.Sprintf("path finding probability: fromnode=%v,"+
" tonode=%v, probability=%v", fromVertex, toNode,
edgeProbability)
}))
// If the probability is zero, there is no point in trying.
if edgeProbability == 0 {