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.
 

Reply via email to