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

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Fri Feb 28 10:34:50 EST 2014

This code is probably the problem:

    (require/typed racket/unsafe/ops
                   [(unsafe-fx+ index+) [Index Index -> Index]]
                   [unsafe-fx+    [Fixnum Fixnum -> Fixnum]]
                   [unsafe-fx- (Fixnum Fixnum -> Fixnum)]
                   [unsafe-fl+ (Flonum Flonum -> Flonum)]
                   [unsafe-fl- (Flonum Flonum -> Flonum)]
                   [unsafe-fl* (Flonum Flonum -> Flonum)]

TR already provides types for these functions, so you can use:

    (require racket/unsafe/ops)

`require/typed' adds contracts to its imports (for safe typed-untyped
interop), which add a significant cost (85% of the running time,
according to the contract profiler).

Removing the `require/typed' (except for `index+') brings the running
time (of the portion you were profiling) down from 22s to 15s. Replacing
the `index+'s with generic `+' and `assert's (to enforce `Index'
results) brings the running time down to 2.5s.


At Fri, 28 Feb 2014 10:08:35 -0500,
Stephen Bloch wrote:
> [1  <multipart/signed (7bit)>]
> [1.1  <text/plain; windows-1252 (quoted-printable)>]
> On Feb 17, 2014, at 10:23 AM, Vincent St-Amour <stamourv at ccs.neu.edu> wrote:
> > As Matthias said, if you can share your code, I'd be happy to have a
> > look.
> Sorry I haven’t gotten around to posting this in the intervening week and a half.  Anybody who’s curious, please see https://www.dropbox.com/sh/guhsnas7aldecx7/NxsLBA5573 .
> Stephen Bloch
> sbloch at adelphi.edu
> [1.2 Message signed with OpenPGP using GPGMail <application/pgp-signature (7bit)>]
> No public key for 5A5812B95344C28E created at 2014-02-28T10:08:35-0500 using RSA
> [2  <text/plain; us-ascii (7bit)>]
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.