Re: [julia-users] Re: When are function arguments going to be inlined?

2015-06-24 Thread Andrew
Yup, I like that idea too. Multiple dispatch is quite useful here. This is my implementation. abstract UtilityFunction immutable CRRA : UtilityFunction sigmac::Float64 sigmal::Float64 psi::Float64 end immutable LogUtility : UtilityFunction end function

Re: [julia-users] Re: When are function arguments going to be inlined?

2015-06-24 Thread Colin Bowers
Looks good to me! Cheers, Colin On 24 June 2015 at 23:04, Andrew owen...@gmail.com wrote: Yup, I like that idea too. Multiple dispatch is quite useful here. This is my implementation. abstract UtilityFunction immutable CRRA : UtilityFunction sigmac::Float64 sigmal::Float64

[julia-users] Re: When are function arguments going to be inlined?

2015-06-23 Thread Andrew
Thanks, this is all very useful. I think I am going to back away from using the @anon functions at the moment, so I'll postpone my idea to encapsulate the functions into a type. Instead, I will just pass a parameter type to an externally defined(not nested) function. I had thought this would be

[julia-users] Re: When are function arguments going to be inlined?

2015-06-23 Thread colintbowers
Yes, this proves to be an issue for me sometimes too. I asked a StackOverflow question on this topic a few months ago and got a very interesting response, as well as some interesting links. See here:

Re: [julia-users] Re: When are function arguments going to be inlined?

2015-06-23 Thread Colin Bowers
Yes, that is pretty much how I would do it, although, as I said in my previous post, I would set `UtilityFunction` to an abstract type, and then define my actual utility function immutable, say `MyCustomUtilityFunc`, as a subtype of `UtilityFunction`. That way you can easily add different types of

[julia-users] Re: When are function arguments going to be inlined?

2015-06-22 Thread Peter Simon
Instead of compile ftest1 and ftest2 I meant compile the functions hello defined in ftest1 and ftest2 On Monday, June 22, 2015 at 9:58:09 AM UTC-7, Peter Simon wrote: It looks to me like your code measures how long it takes Julia to compile ftest1 and ftest2. Neither of these top-level

[julia-users] Re: When are function arguments going to be inlined?

2015-06-22 Thread Andrew
edit, fixed code to actually do what I meant. function ftest1() u(x) = log(x) function hello(fun::Function) for i = 1:1000 fun(i.^(1/2)) end end hello(u) end function ftest2() function hello() for i = 1:1000

[julia-users] Re: When are function arguments going to be inlined?

2015-06-22 Thread Andrew
Sorry, I actually noticed that right before I got your post. I fixed it. Oddly enough the inlined version is still about twice as fast, as before. On Monday, June 22, 2015 at 12:58:09 PM UTC-4, Peter Simon wrote: It looks to me like your code measures how long it takes Julia to compile