[racket] profiling

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Thu Nov 10 10:28:43 EST 2011

Here's a program:

#lang racket

(define (even? n)
  (if (zero? n) true (odd? (sub1 n))))

(define (odd? n)
  (if (zero? n) false (even? (sub1 n))))

Go to Language | Choose Language, click on Show Details, and at the
top-right, select "Debugging and profiling".

Now run the program and in the interactions window, run

> (even? 25)

Go to View | Show Profile.  At the bottom of your screen will be the
profiling information, showing 13 calls each to even? and odd?.

If you run

> (even? 25)

again in the interactions window, the profile doesn't appear to
change.  But click on Update Profile (bottom-left) and it'll now show
26 calls each.

>From there, mess around!


Posted on the users mailing list.