Hi All,
I'm currently writing a small ray tracer in julia, and encounter a 25% 
slowdown when new, totally unused code, is added.

I've created an abstract type "Object" which represents any object that can 
exist in a scene.  Spheres, Cubes, Planes are all defined to be subtypes of 
Object.  Each of the concrete types has two associated functions 
"intersect" and "contact_normal"

I've added to the code a new Object subtype AABB (along with its associated 
intersect/normal functions), but I have not yet instantiated an object of 
that type, nor have I called any of the functions that require this type.

If I define "type AABB <: Object" the code is 25% slower than if I define 
just "type AABB". So even though this code is never called, if I make AABB 
a subtype of Object it is 25% slower than if I don't.

The code can be cloned from https://bitbucket.org/mikefc/julia-pathtracer 
and the definition of the AABB type is in AABB.jl.

Is there something weird going on with multiple dispatch?  Is there some 
weird changeover in function handling if I have too many functions with 
almost the same signature?  Why is unused code making my program slower? 
 What does that have to do with the type of the unused code?

Any help appreciated.
Mike.

Reply via email to