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

From: Stephen Bloch (bloch at adelphi.edu)
Date: Mon Feb 17 10:37:56 EST 2014

On Feb 17, 2014, at 10:23 AM, Vincent St-Amour <stamourv at ccs.neu.edu> wrote:

> 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
> cost.

No, the definitions and the benchmarks are all in one typed/racket source file, run from the command line with “racket typed-matops.rkt”.

> 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?

Many segments of code are highlighted in green, if that’s what you mean.  A few are pink, but they’re not the ones being timed (e.g. the function that builds a random square matrix of a given size, to be handed to all three multiplication algorithms).

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

Sure.  That may take a few hours: I have to run off to class now.

Stephen Bloch
sbloch at adelphi.edu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.racket-lang.org/users/archive/attachments/20140217/7fd4992d/attachment.sig>

Posted on the users mailing list.