[julia-users] Re: Pesky type instability

2016-06-12 Thread Matt Bauman
Constructing expressions with strings for a generated function is definitely much more complicated and harder to read. And it'll almost certainly take more resources and time during compilation. You'll probably also be very interested in Base.Cartesian. See the developer documentation here:

[julia-users] Re: Pesky type instability

2016-06-12 Thread Kristoffer Carlsson
Yes the splatting is the problem. But since you are using a generated function you can just generate code to avoid splatting. Evaling a string should on 0.4 not affect the performance of the generated function but on 0.5 I think you can't even call eval in generated functions (for technical

[julia-users] Re: Pesky type instability

2016-06-12 Thread Richard Dennis
Hi Kristoffer, yes, the return type is stable because I explicitly declared weights as Array{T,N}. With order being a 1D array it needs to be "converted" to a tuple to initialize the weights array and I don't see too many ways of doing this. The problem seems to be present is the following

[julia-users] Re: Pesky type instability

2016-06-12 Thread Kristoffer Carlsson
I would discourage generating code by creating strings and parsing them. It is much better to use actual julia expressions. Anyway, from what I see, you don't have a problem with the return type but with an intermediate value and that is from doing this: julia> g{S}(order::Array{S}) =