id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
2466	Execution time mis-accounting	heatsink		"In the attached test case, profiling assigns a large fraction of run time to a single function.  The fraction ranges from 19% to 40% across runs.  Although I haven't independently verified the profile, I believe execution time is mis-attributed to this function.

The function in question is:

{{{
intersect :: Object -> Ray -> Maybe Intersection
intersect obj@(Object dat mem) = objmIntersect mem dat obj
}}}

where `objmIntersect` is a field selector.  In `-ddump-simpl` output, the function consists of two case statements and a function call.  The function it calls has its own SCC.

In profiling, this function is usually listed as the most time-consuming function in the program.  Its callee is assigned a similar amount of time.  Both functions are called the same number of times.  The callee computes a ray-triangle intersection, which is presumably more time-consuming than two case statements and a function call...

{{{
COST CENTRE                    MODULE               %time %alloc

intersect                      Datatypes             28.5   11.3
triangle.intersect             Triangle              25.0    2.0
(other functions...)
}}}

I've reduced the test case from a somewhat larger ray tracer.  I'm willing to help reduce it further if needed.  The test case depends on the [http://haskell.org/haskellwiki/Vector-space vector-space] library."	bug	closed	high	7.4.1	Profiling	7.3	fixed			Linux	x86	None/Unknown	Unknown				
