Re: [racket-users] Understanding compilation costs and creating persistent values

2017-07-20 Thread David Storrs
On Thu, Jul 20, 2017 at 2:56 PM, Matthew Flatt wrote: > Adding to other replies: > > At Thu, 20 Jul 2017 13:32:49 -0400, David Storrs wrote: > > Will any of the above items be compiled away? > > You can compile a module with `raco make` and look at the compiled code > with `raco decompile`. If I

Re: [racket-users] Understanding compilation costs and creating persistent values

2017-07-20 Thread Matthew Flatt
Adding to other replies: At Thu, 20 Jul 2017 13:32:49 -0400, David Storrs wrote: > Will any of the above items be compiled away? You can compile a module with `raco make` and look at the compiled code with `raco decompile`. If I put your code in a module and try that, the output includes (de

Re: [racket-users] Understanding compilation costs and creating persistent values

2017-07-20 Thread Neil Van Dyke
David Storrs wrote on 07/20/2017 01:32 PM: sub foo { state $x = 0; say $x++; } # $x is not visible in this scope foo(); foo(); foo(); (define foo (let ((x 0)) (lambda () (printf "~s~n" x) (set! x (add1 x) ; x is not visible in this scope (foo) (foo) (foo) Doing this wi

Re: [racket-users] Understanding compilation costs and creating persistent values

2017-07-20 Thread Leif Andersen
> Will any of the above items be compiled away? To answer your first question, I would recommend taking a look at the optimization coach. It can help you figure out what code was inlined away and what wasn't. You can find it in: View -> Show Optimization coach > How many times will each thing be

[racket-users] Understanding compilation costs and creating persistent values

2017-07-20 Thread David Storrs
Given this code: (define (foo) (define num (+ 1 1)); result of a function that is program-local (define size (file-size "/some/path")) ; result of a function that touches the disk, but result never used (define other-size (file