More docs about contract costs in TR.

This commit is contained in:
Vincent St-Amour 2014-02-28 11:36:51 -05:00
parent 3a2c2514a6
commit 1fa0bb0e03
2 changed files with 20 additions and 1 deletions

View File

@ -166,3 +166,7 @@ Additionally, macros that are defined in Typed Racket modules cannot
be used in ordinary Racket modules because such uses can be used in ordinary Racket modules because such uses can
circumvent the protections of the type system. circumvent the protections of the type system.
@section{Expensive contract boundaries}
Contract boundaries installed for typed-untyped interaction may cause
significant slowdowns. See @secref{contract-costs} for details.

View File

@ -159,7 +159,7 @@ preferable to vectors. Typed Racket can optimize struct access in all
cases. cases.
@subsection[#:tag "optimization-coach"]{Optimization Coaching} @subsection[#:tag "optimization-coach"]{Optimization coaching}
The Optimization Coach package provides optimization coaching support to help The Optimization Coach package provides optimization coaching support to help
you get the most of the Typed Racket optimizer. you get the most of the Typed Racket optimizer.
@ -173,3 +173,18 @@ debugging information. Setting the Racket logging level can be done on the
command line with the @racket[-W] flag: command line with the @racket[-W] flag:
@commandline["racket -W debug@TR-optimizer my-typed-program.rkt"] @commandline["racket -W debug@TR-optimizer my-typed-program.rkt"]
@subsection[#:tag "contract-costs"]{Contract boundaries}
When interoperating with untyped code (see @secref{typed-untyped-interaction}),
contracts are installed between typed and untyped modules. Contracts can have
significant overhead, thus typed-untyped boundary crossings should be avoided
in performance-sensitive code.
Typed Racket provides types for most of the bindings provided by @tt{#lang
racket}; using @racket[require/typed] is unnecessary in these cases.
If you suspect that contracts at a typed-untyped boundary may be have a
significant cost in your program, you can investigate further using the
contract profiler.