Here's a recap of a few points, now that I've spent some time
investigating the issue.


Replicating the problem and detecting debugging mode:

If you start DrRacket fresh or create a new tab and paste

    (define (total n)
      (for/sum ([x (in-range (+ 1 n))]) x))
    (time (total 1000000000))

into the interactions window, then it runs at non-debugging speed.
After clicking "Run" (with an empty program), the interactions window
runs the example with debugging speed.

That difference seems confusing, and it might explain why some had
trouble seeing the example run slowly.

In any case, I agree with the suggest that making DrRacket more clearly
display its current mode could be helpful.


Performance with debugging enabled:

I've made some compiler improvements that cut the debugging-mode time
for the example in half.

I don't think a factor of 10 is completely out of line for a program
that counts up to a billion and adds a pair of small numbers along the
way. Those are such small and optimizable steps that demanding extra
transparency is bound to get in the way. More typical/useful programs
see a smaller cost, because they use larger primitives and spend more
time in libraries.

Even for traditional Scheme benchmarks --- which are written using
minimal bits of the language so that there's little opportunity to hide
behind macro expansions or libraries --- most programs run in debug
mode with slowing factors in the x1.5 to x4 range. That seems
consistent with my experience running unoptimized C for debugging.


Improving the way debugging instrumentation works:

Since the example uses `for/sum`, it should benefit from spending its
time in a library abstraction that is not in debugging mode, as it did
in v6.2 and earlier.

I have an idea for restoring v6.2-like debugging, and I've replied to
Vincent's `syntax-original?` question on the dev list. (Everyone is
welcome to participate there, of course).

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to