I'm guessing this is a contract issue, but it looks to me like calls from racket into typed/racket are slow. To wit:
#lang racket/load (module a typed/racket (provide float-add) (: float-add (Float Float -> Float)) (define (float-add a b) (+ a b)) (printf "a million in-module typed adds\n") (define l (time (for: ([i : Fixnum (in-range 1000000)]) (float-add 0.009872 0.298719))))) (module ut racket (provide untyped-float-add) (define (untyped-float-add a b) (+ a b))) (module b racket (require 'a) (require 'ut) (provide l1 l2) (printf "a million untyped adds\n") (define l1 (time (for ([i (in-range 1000000)]) (untyped-float-add 0.009872 0.298719)))) (printf "a million untyped->typed adds\n") (define l2 (time (for ([i (in-range 1000000)]) (float-add 0.009872 0.298719))))) (require 'b) => Welcome to DrRacket, version 5.2.0.7--2012-01-05(fd5e40f/g) [3m]. Language: racket/load; memory limit: 256 MB. a million in-module typed adds cpu time: 404 real time: 425 gc time: 273 a million untyped adds cpu time: 372 real time: 394 gc time: 212 a million untyped->typed adds cpu time: 3763 real time: 3979 gc time: 2077 ... so in fact, TR is about the same speed as plain-old racket in adding these (even though the plain-old-racket call is across modules); I conjecture that racket's optimizer is discovering the same optimizations as TR, here. However, making a cross-module call to a TR module is *much* slower. Is this because this module-crossing requires a contract check? John
smime.p7s
Description: S/MIME cryptographic signature
____________________ Racket Users list: http://lists.racket-lang.org/users