[racket] Everything type-checks; on to benchmarking and optimization

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Mon Feb 17 10:23:44 EST 2014

At Sun, 16 Feb 2014 23:43:30 -0500,
Bloch Stephen wrote:
> The results so far: the typed version is taking 20-30 times longer
> than the untyped version.  Huh?

Are you measuring the time from an untyped driver module, or from within
Typed Racket? If you're, for example, constructing matrices on the
untyped side, and passing them to the typed side, every matrix access
will trigger contract checking (to protect the typed module's invariants
from invalid inputs from the untyped side), which can have a significant

You can try using the contract profiler (`(require contract-profile)' in
post-5.3.6 Racket) to see whether contracts are the problem. If so, you
can try moving more code from untyped to typed to avoid contracts.

> I've installed the optimization coach, and am looking through its
> recommendations.  For the untyped version, it suggested a couple of
> inlinings.  For the typed version, nothing.

Does the optimization coach confirm that optimizations are happening in
the typed version?

As Matthias said, if you can share your code, I'd be happy to have a


Posted on the users mailing list.