[plt-scheme] Question on profiling

From: Ballnat, Stefan (Stefan.Ballnat at fokus.fraunhofer.de)
Date: Thu Mar 5 04:57:30 EST 2009

Hi,

I was just profiling my code in DrScheme because of some performance
problems. I read the documentation about "Using errortrace" but still
have a problem.

I have a simple function like:

(define (slow-func x y)
  (let* ((a (foo1 x))
         (b (foo2 y)))
    (foo3 a b)))

With some function definitions:

(define (foo1 x) ... )
(define (foo2 y) ... )
(define (foo3 a b) ... )

Now the output of the profile is (about):

slow-func 	- 6000ms 	- 1 call
foo1		- 0ms 	- 1 call
foo2		- 0ms 	- 1 call
foo3 		- 0ms 	- 1 call

Now, I wonder how I should interpret these results? How can "slow-func"
run so slow when the rest runs so fast? I was assuming "foo1" in my
program to be the bottleneck, but the profile results showed something
else. Is this behavior a result of the let*-expression and would it be
of help, if I define "a" and "b" in some separate functions or writing
"(foo3 (foo1 x) (foo2 y))" instead?

Thanks in advance,

- Stefan


Posted on the users mailing list.