Re: [julia-users] Re: Addition of (unused uninstatiated) type, slows down program by 25%

2014-05-31 Thread Mike Innes
You should definitely open an issue about this – if your timings are right
it's definitely not desirable behaviour.

https://github.com/JuliaLang/julia/issues?state=open


On 31 May 2014 11:00, mike c coolbutusel...@gmail.com wrote:

 I've narrowed down the problem.  It's not a profiling problem.  Julia
 seems to have a step-change in speed when there are too many functions of a
 similar signature.

 I've made a short example that reproduces this slowdown:
 http://pastebin.com/iHAa2Cws

 Run the code once as-is, and then uncomment the intersect() function which
 is currently disabled and run it again.   I see a 20% drop in speed. Note:
 This intersect function is NEVER actually being called. And the type it is
 related to is NEVER INSTANTIATED.

 I think this probably qualifies as a bug, but it may just be the price to
 pay for multiple dispatch when there are too many functions (in this case 5
 functions) to choose from.



Re: [julia-users] Re: Addition of (unused uninstatiated) type, slows down program by 25%

2014-05-31 Thread mike c


On Sunday, 1 June 2014 00:21:07 UTC+10, Simon Kornblith wrote:

 Yes, this is kind of a toy solution to a toy example. It sounds like what 
 you describe is implementable as:

 f(i, object, objects..) = min(intersect(object, i), f(i, objects...))
 f(i) = 0.0

 I did try something like that in the example code, but it turned out 
slower than the naive looping case.

(It's also possible that dynamic dispatch isn't actually a bottleneck in 
 your code, depending on how much is happening in the intersect function.)

There's quite a bit happening in each intersect function, I think dynamic 
dispatch is probably not a big part of the overall runtime, but I'll take 
any performance improvements that I can get.

Since the objects are set in stone once the program starts, is it possible 
to convert the list of objects into the list of functions that must be 
called.  I.e. do the dynamic dispatch lookup *once* and then cache that in 
another structure/array? 

Mike.