Skip to content

Commit

Permalink
tweak inlining threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jun 9, 2014
1 parent e9e5606 commit ec2fa85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,7 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
end
end
free = effect_free(aei,sv,true)
if ((occ==0 && is(aeitype,None)) || islocal || (occ > 1 && !inline_worthy(aei, occ)) ||
if ((occ==0 && is(aeitype,None)) || islocal || (occ > 1 && !inline_worthy(aei, occ*2)) ||
(affect_free && !free) || (!affect_free && !effect_free(aei,sv,false)))
if occ != 0 # islocal=true is implied by occ!=0
vnew = unique_name(enclosing_ast, ast)
Expand Down Expand Up @@ -2401,14 +2401,14 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
end

inline_worthy(body, cost::Real) = true
function inline_worthy(body::Expr, cost::Real=1) # precondition: 0<cost
function inline_worthy(body::Expr, cost::Real=1.0) # precondition: 0<cost
# if isa(body.args[1],QuoteNode) && (body.args[1]::QuoteNode).value === :inline
# shift!(body.args)
# return true
# end
symlim = int(5/cost)+1
symlim = 1+5/cost
if length(body.args) < symlim
symlim *= 6
symlim *= 16
if occurs_more(body, e->true, symlim) < symlim
return true
end
Expand Down

0 comments on commit ec2fa85

Please sign in to comment.