On Feb 28, 2014, at 10:34 AM, Vincent St-Amour <stamo...@ccs.neu.edu> wrote:
> 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). Yike! Thanks; I never would have thought of that. There’s probably something in the documentation about “require/typed” as a source of inefficiency, but for whatever reason I didn’t stumble upon it. > 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. Generic ‘+’, not ‘unsafe-fx+’? Should I be using racket/unsafe/ops at all? Stephen Bloch sbl...@adelphi.edu
signature.asc
Description: Message signed with OpenPGP using GPGMail
____________________ Racket Users list: http://lists.racket-lang.org/users