[racket] deceptive perfomance for typed racket in integer division
On Tue, Dec 11, 2012 at 11:43 AM, daniel rupis
<danielrupistralizavez at yahoo.es> wrote:
> Sam Tobin-Hochstadt <samth at ...> writes:
>
>>
>> While you're certainly right about DrRacket introducing noise in
>> performance measurement, I don't think you need to generate an
>> executable to eliminate that overhead. Simply running `racket` from
>> the command line on a file in a module ought to be sufficient.
>>
>> Sam
>
> Hello Sam.
>
> I am using racket from the console, not using DrRacket. I just copy the code
> with control-c and paste with control-v then wait a seconds for the definitions
> to be loaded in memory and then run the test.
>
> I was going to use raco exce ... but it asks about a module (perhaps I should
> read the section about using raco to generate a standalone executable).
To get the best performance from Racket, and in general for other
benefits of Racket, code should be written in a module. Most
straightforwardly, this means placing it in a file with `#lang
racket/base` at the top, and then running that file with `racket
filename.rkt`.
> Anyway, my point was that I was expecting something more from typed racket.
> Since typed racket use types (like declaring type in sbcl) I was expected better
> perfomance, that's all.
The types you declared in SBCL and the types you declared in Typed
Racket are very different, which results in the performance difference
-- you used a bounded integer type in SBCL, and the arbitrary-size
bignum type `Integer` in Typed Racket. As Pierpaolo shows, if you use
fixnum operations in Racket, you get similar performance to SBCL.
Sam