-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
The Julia docs recommend that in some cases, variables can be type-annotated (LHS, not RHS). The section
https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-captured
says,
If captured variables are used in a performance-critical section of the code, then the following tips help ensure that their use is performant. First, if it is known that a captured variable does not change its type, then this can be declared explicitly with a type annotation (on the variable, not the right-hand side):
function abmult2(r0::Int)
r::Int = r0
if r < 0
r = -r
end
f = x -> x * r
return f
endAnnotations like r::Int = r0 sometimes lead to problems if GG also decides to box that variable. Could a type declaration like this be taken by GG as an assertion that the variable is unboxed?
This is related to cscherrer/Soss.jl#337
Metadata
Metadata
Assignees
Labels
No labels