narrowed down the problem area

downs default_357-line at yahoo.de
Fri Feb 15 07:47:35 PST 2008


downs wrote:
> I've been playing around with the 8-9s version posted earlier.
> 
> The problem seems to lie in ray_sphere.
> 
> Strangely, Vec v = void; Vec.sub(center, ray.orig, v); runs in 8.8s, producing a correct output once the printf at the bottom has been fixed,
> but Vec v = center - ray.orig; runs in 11.1s.
> 
> Still investigating why this happens.
> 
>  --downs

Okay, found the cause, if not the reason, by looking at the assembler output.

For some reason, the bad case, although inlined, stores its values back into memory. The fast case keeps working with them.

Here's the disassembly for ray_sphere for both cases:

slow (opSub)

http://paste.dprogramming.com/dpcds3p3

fast

http://paste.dprogramming.com/dpd6pi8n

So it comes down to a GDC FP "bug". I think changing to 4.2 or 4.3 might help. Does anybody have an up-to-date version of the 4.2.x patch?

 --downs



More information about the Digitalmars-d mailing list