I alluded to a compilation option to enable/disable types, much in the way of

typed/racket

     and

typed/racket/no-check.


In my foray into using Typed Racket, two performance issues persist, 
compilation speed and runtime speed of my hybrid code.   The reasons why are 
clear and the fact that it works at all is great.

Not having that option to 'raco exe ...', I changed all my #lang lines in 40 
files to:

#lang s-exp "mytyped.rkt"

That "mytyped.rkt" file contains:

---------------------------------------------------------------------
#lang racket

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This permits flip-flopping between
; typed and typed/no-check
;
; Use one and comment the other
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Type checking active
#;(require typed/racket)
#;(provide (all-from-out typed/racket))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Type checking inactive
(require typed/racket/no-check)
(provide (all-from-out typed/racket/no-check))
(define-syntax-rule (require/typed module-name ignored ...)
  (require module-name))
(provide require/typed)
---------------------------------------------------------------------

I comment out the undesired section, enabling/disabling type checking.  Using 
my test suite, here's how three programs compare in relation to compilation and 
execution time.

Previous untyped version:
     Compilation time: 13 seconds
     Execution time: 18 minutes

Hybrid version with type checking on:
     Compilation time: 178 seconds
     Execution time: 33 minutes

Hybrid version with type checking off:
     Compilation time: 44 seconds
     Execution time: 22 minutes

The executable in both hybrid versions is 16 megs, about double the untyped 
compiled size.  Runtime memory use is similar across all three and proportional 
to the number of instantiated places.  The result of this test is about 122,000 
time series; they match output in all versions.

Note that mytyped.rkt includes a macro for an apparently missing require/typed 
form.  

--------------------

One question that concerns me is whether the following statement is correct:

A typed program that does not have conditions based upon type predicates, e.g. 
port? or integer?, should act the same when stripped of its types.  

---------------------

Anyway, this felt like too easy a way to get my hybrid performance back.  If 
the Typed version actually ends up faster, then I'm set too.  If anyone sees 
something faulty or improvable, I'm open to advice.

Thanks (again),
John Griffin






-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to