Re: [racket-users] Apple M1

2020-11-24 Thread Andrew Gwozdziewycz
Have you tried running it under Rosetta 2? 

$ arch -x86_64 racket
# or do
$ arch -x86_64 zsh
# now all commands will run under Rosetta 2

Or so I believe from seeing people with similar problems, with other software. 
I have not tested this, and do. Not have an M1 Mac. And, I have no idea how to 
run Dr Racket under this...

Hope this helps!?

> On Nov 23, 2020, at 20:08, Zachary Rippas  wrote:
> 
> Does anyone know when/if a download version of racket will be released that 
> supports Apple's new chip? I am using an M1 laptop and can't launch any intel 
> version of racket; it says quit unexpectedly.
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/619e8e24-a75c-4e9c-b172-d19a2892145cn%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/656D2E25-9CA7-48C1-B686-17DB614BB202%40gmail.com.


Re: [racket-users] Questions

2020-11-24 Thread Nate Griswold
Very helpful.

I have modified my code to use callbacks and everything is working as
expected. It is interesting that everything was working fine with my
racket_apply and racket_eval hacks, as well.

I have gotten my communication with racket down to one put and one get
closure, wrapping a call to place-channel-put and place-channel-get. I
think this is working well and the c client module is now mostly oblivious
to racket, it just thinks it is using standard c function pointers so that
is good. I do still have to Sactivate_thread and Sdeactivate_thread to
construct my values and call the procs but that is ok, it is nice now.

The cast works properly for me, i thought i had tried that already but it
works fine. I didn't realize `cast` works for source values that are
already racket values but it makes sense that it could detect racket values
and just not call c-to-racket, i guess.

Nate


On Mon, Nov 23, 2020 at 7:01 AM Matthew Flatt  wrote:

> At Mon, 23 Nov 2020 00:14:56 -0600, Nate Griswold wrote:
> > Hello. I have a few questions:
> >
> > 1) Why do the docs say that racket_eval and racket_apply eval and apply
> in
> > the “initial” or “original” racket thread? I have verified that the
> thread
> > id returned from pthread_self when using racket_apply in c code called
> from
> > a racket place is different from the thread id of the thread i called
> > racket_boot on.
>
> The `racket_apply` function was intended for use only in the OS thread
> where Racket is booted, and only "outside" to get Racket started. It's
> not intended for use in callbacks from Racket.
>
> That's generally true for functions listed in sections 4-6 of "Inside",
> and I see that the intent is not remotely clear there. I'll improve the
> documentation.
>
> To call back to Racket from C code, you should use the Racket FFI,
> where a Racket function that's passed to C gets converted to a function
> pointer for the C side. When you call that callback (as a regular C
> function call), various bits of Scheme and Racket state get
> configured/restored in a consistent way before jumping to the wrapped
> Racket code as a callback.
>
> For simple things, it turns out that `Scall0`, etc. would work to
> invoke a callback within the Racket context that had called into C, but
> there are many pitfalls, so you shouldn't do that.
>
> You definitely should not use `racket_apply` or `racket_eval` from C
> that was called from Racket. It will... well, do something. Take the
> uncertainly of using `Scall0` and multiply by 100, since functions like
> `racket_apply` specifically attempt to interact with the thread
> scheduler.
>
> > 2) I noticed that if i racket_eval in c code called by a racket place, i
> > can’t evaluate things that would otherwise (in racket code) be available
> in
> > the place’s namespace. What is the correct way to get at things in the
> > place’s racket namespace from c code? Is my problem unique to using a
> > place, or would i have this problem in a non-place scenario as well?
>
> I think it's probably not just about places, but let me answer the
> "correct way" question with the next bullet.
>
> > 3) (related to 2) I want to be able to put and get from a place channel
> > from a long-running c function. If i just pass a place channel to the
> > function, that is wrong because if i am correct in my thinking (and in
> what
> > i have witnessed) there is a chance that when i go to use that channel in
> > the future, it will have been moved by the garbage collector. Is there
> any
> > way to prevent a specific value from being garbage collected, at least
> for
> > the lifetime of my place? This is related to (2) because i actually don’t
> > need this functionality if i can just racket_eval to get at the place
> > channel from the namespace of the place’s module in the middle of a
> > Sactivate_thread / Sdeactivate_thread session.
>
> The best approach here is to hand the C code a callback, which it will
> see as plain old C functions. Maybe there's one callback to get from
> the channel and another to put to the channel --- where the channel is
> in the closure of the function, although the C side has no idea about
> closures. If you go that route, then as long as you retain a reference
> to the callback closure on the Racket side, the callback function
> itself won't move.
>
> Overall, reasoning about the interaction between Racket/Scheme and C
> interaction from the C side is very difficult. The more you can arrange
> for the C code to oblivious to Racket, the easier things get, because
> the Racket-side tools for interacting with C are much better.
>
> > 3) Is there any way to pass a c callback function into racket so that
> > racket can call that function? I defined a ctype for the function, but i
> > couldn’t think of a way to cast a pointer value passed into racket from c
> > to an instance of my ctype (the `cast` function takes existing ctypes and
> > not numeric values). Is there any way to manually make a value for my
>

[racket-users] snappier place startup time

2020-11-24 Thread Nate Griswold
Is there any way to make places startup faster? Even if i do an explicit
round trip using place-channel-put and place-channel-get on both sides, it
takes on the order of centiseconds for near empty places to start up.

My program requires the threads for a couple places to be set up before it
can operate, so this impacts my startup time by quite a bit.

I have one place that has a very simple module and one place with a more
complicated module. Is there some sequence that i should do things in for
the minimal startup time? It seems nothing i do really helps much.

Nate

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7vm1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.


[racket-users] Re: snappier place startup time

2020-11-24 Thread Nate Griswold
Oh, and i'm still on Racket 7.8. Don't know if 7.9 addresses anything.

Nate


On Tue, Nov 24, 2020 at 5:04 AM Nate Griswold 
wrote:

> Is there any way to make places startup faster? Even if i do an explicit
> round trip using place-channel-put and place-channel-get on both sides, it
> takes on the order of centiseconds for near empty places to start up.
>
> My program requires the threads for a couple places to be set up before it
> can operate, so this impacts my startup time by quite a bit.
>
> I have one place that has a very simple module and one place with a more
> complicated module. Is there some sequence that i should do things in for
> the minimal startup time? It seems nothing i do really helps much.
>
> Nate
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPqsKQNA8_g25wgtFmK7MzADZs%2B2wdCKt7Em%2BKteWh02-A%40mail.gmail.com.


Re: [racket-users] Questions

2020-11-24 Thread Nate Griswold
Please ignore that last sentence.

Nate


On Tue, Nov 24, 2020 at 4:59 AM Nate Griswold 
wrote:

> Very helpful.
>
> I have modified my code to use callbacks and everything is working as
> expected. It is interesting that everything was working fine with my
> racket_apply and racket_eval hacks, as well.
>
> I have gotten my communication with racket down to one put and one get
> closure, wrapping a call to place-channel-put and place-channel-get. I
> think this is working well and the c client module is now mostly oblivious
> to racket, it just thinks it is using standard c function pointers so that
> is good. I do still have to Sactivate_thread and Sdeactivate_thread to
> construct my values and call the procs but that is ok, it is nice now.
>
> The cast works properly for me, i thought i had tried that already but it
> works fine. I didn't realize `cast` works for source values that are
> already racket values but it makes sense that it could detect racket values
> and just not call c-to-racket, i guess.
>
> Nate
>
>
> On Mon, Nov 23, 2020 at 7:01 AM Matthew Flatt  wrote:
>
>> At Mon, 23 Nov 2020 00:14:56 -0600, Nate Griswold wrote:
>> > Hello. I have a few questions:
>> >
>> > 1) Why do the docs say that racket_eval and racket_apply eval and apply
>> in
>> > the “initial” or “original” racket thread? I have verified that the
>> thread
>> > id returned from pthread_self when using racket_apply in c code called
>> from
>> > a racket place is different from the thread id of the thread i called
>> > racket_boot on.
>>
>> The `racket_apply` function was intended for use only in the OS thread
>> where Racket is booted, and only "outside" to get Racket started. It's
>> not intended for use in callbacks from Racket.
>>
>> That's generally true for functions listed in sections 4-6 of "Inside",
>> and I see that the intent is not remotely clear there. I'll improve the
>> documentation.
>>
>> To call back to Racket from C code, you should use the Racket FFI,
>> where a Racket function that's passed to C gets converted to a function
>> pointer for the C side. When you call that callback (as a regular C
>> function call), various bits of Scheme and Racket state get
>> configured/restored in a consistent way before jumping to the wrapped
>> Racket code as a callback.
>>
>> For simple things, it turns out that `Scall0`, etc. would work to
>> invoke a callback within the Racket context that had called into C, but
>> there are many pitfalls, so you shouldn't do that.
>>
>> You definitely should not use `racket_apply` or `racket_eval` from C
>> that was called from Racket. It will... well, do something. Take the
>> uncertainly of using `Scall0` and multiply by 100, since functions like
>> `racket_apply` specifically attempt to interact with the thread
>> scheduler.
>>
>> > 2) I noticed that if i racket_eval in c code called by a racket place, i
>> > can’t evaluate things that would otherwise (in racket code) be
>> available in
>> > the place’s namespace. What is the correct way to get at things in the
>> > place’s racket namespace from c code? Is my problem unique to using a
>> > place, or would i have this problem in a non-place scenario as well?
>>
>> I think it's probably not just about places, but let me answer the
>> "correct way" question with the next bullet.
>>
>> > 3) (related to 2) I want to be able to put and get from a place channel
>> > from a long-running c function. If i just pass a place channel to the
>> > function, that is wrong because if i am correct in my thinking (and in
>> what
>> > i have witnessed) there is a chance that when i go to use that channel
>> in
>> > the future, it will have been moved by the garbage collector. Is there
>> any
>> > way to prevent a specific value from being garbage collected, at least
>> for
>> > the lifetime of my place? This is related to (2) because i actually
>> don’t
>> > need this functionality if i can just racket_eval to get at the place
>> > channel from the namespace of the place’s module in the middle of a
>> > Sactivate_thread / Sdeactivate_thread session.
>>
>> The best approach here is to hand the C code a callback, which it will
>> see as plain old C functions. Maybe there's one callback to get from
>> the channel and another to put to the channel --- where the channel is
>> in the closure of the function, although the C side has no idea about
>> closures. If you go that route, then as long as you retain a reference
>> to the callback closure on the Racket side, the callback function
>> itself won't move.
>>
>> Overall, reasoning about the interaction between Racket/Scheme and C
>> interaction from the C side is very difficult. The more you can arrange
>> for the C code to oblivious to Racket, the easier things get, because
>> the Racket-side tools for interacting with C are much better.
>>
>> > 3) Is there any way to pass a c callback function into racket so that
>> > racket can call that function? I defined a ctype for the function, but i
>> > couldn’t

Re: [racket-users] Apple M1

2020-11-24 Thread Paulo Matos


Zachary Rippas writes:

> Does anyone know when/if a download version of racket will be released that 
> supports Apple's new chip? I am using an M1 laptop and can't launch any 
> intel version of racket; it says quit unexpectedly.

We hope the support for this to be imminent. As far as I understand the
core team is still missing the required hardware to fix the issues that
are cropping up.

Kind regards,

-- 
Paulo Matos

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/87blfngg7k.fsf%40linki.tools.


[racket-users] Pict and pict types

2020-11-24 Thread Tim Jervis
Hi everyone,

In typed racket, vc-append expects arguments of type pict, while plot-pict 
produces results of type Pict. Therefore, to have vc-append accept a plot-pict 
argument, I’m currently casting the result of plot-pict to be of type pict.

>From my understanding of the underlying racket code, Pict just invokes a pict? 
>predicate through an #opaque definition, and cast inserts a runtime test of 
>its argument. Therefore, my cast seems wasteful. Have I missed something? Is 
>there a better way to structure a solution that type-checks?

Here’s some code that type-checks for me:

#lang typed/racket

(require plot
 pict)

(vc-append (cast (plot-pict (function sin 0 1))
 pict))

and the output is a graph, as expected.

Here’s some that fails a type-check:

#lang typed/racket

(require plot
 pict)

(vc-append (plot-pict (function sin 0 1)))

Error output:

;  plot-pict-test.rkt:6:11: Type Checker: type mismatch
;   expected: pict
;   given: Pict
;   in: (plot-pict (function sin 0 1))
; Context (plain; to see better errortrace context, re-run with C-u prefix):
;   
/Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:376:0
 type-check
;   
/Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:619:0
 tc-module
;   
/Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:96:12
;   
/Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:23:4

I get the same results whether I require pict or typed/pict.

I hope this question is of general interest. I have some familiarity with 
regular racket, but I’m only just starting out on typed racket. 

Best,



Tim

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/E0426BDB-9B8A-4AE9-8550-3871ACC6BF2A%40timjervis.com.


[racket-users] Re: Pict and pict types

2020-11-24 Thread Alex Harsanyi
This is a known issue:  plot-pict does not return a typed/pict type · Issue 
#15 · racket/plot (github.com)   

Alex.
On Tuesday, November 24, 2020 at 7:24:17 PM UTC+8 tim wrote:

> Hi everyone,
>
> In typed racket, vc-append expects arguments of type pict, while plot-pict 
> produces results of type Pict. Therefore, to have vc-append accept a 
> plot-pict argument, I’m currently casting the result of plot-pict to be 
> of type pict.
>
> From my understanding of the underlying racket code, Pict just invokes a 
> pict? predicate through an #opaque definition, and cast inserts a runtime 
> test of its argument. Therefore, my cast seems wasteful. Have I missed 
> something? Is there a better way to structure a solution that type-checks?
>
> Here’s some code that type-checks for me:
>
> #lang typed/racket
>
> (require plot
>  pict)
>
> (vc-append (cast (plot-pict (function sin 0 1))
>  pict))
>
>
> and the output is a graph, as expected.
>
> Here’s some that fails a type-check:
>
> #lang typed/racket
>
> (require plot
>  pict)
>
> (vc-append (plot-pict (function sin 0 1)))
>
>
> Error output:
>
> ;  plot-pict-test.rkt:6:11: Type Checker: type mismatch
> ;   expected: pict
> ;   given: Pict
> ;   in: (plot-pict (function sin 0 1))
> ; Context (plain; to see better errortrace context, re-run with C-u 
> prefix):
> ;   
> /Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:376:0
>  
> type-check
> ;   
> /Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:619:0
>  
> tc-module
> ;   
> /Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:96:12
> ;   
> /Applications/Racket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:23:4
>
> I get the same results whether I require pict or typed/pict.
>
> I hope this question is of general interest. I have some familiarity with 
> regular racket, but I’m only just starting out on typed racket. 
>
> Best,
>
>
>
> Tim
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/91d1094d-fe0a-46a9-9fc7-21355dea7163n%40googlegroups.com.


Re: [racket-users] hash-ref in typed Racket

2020-11-24 Thread Tim Jervis
For the type of the third argument, rather than "any non-function", could 
Typed Racket use the type of the values in the hash?

On Tuesday, 21 April 2020 at 15:51:00 UTC+1 Sam Tobin-Hochstadt wrote:

> The problem here is with the optional third argument to `hash-ref`.
> Typed Racket only allows `#f` or functions as the third argument.
> Plain Racket allows any non-function value as a default, or a function
> which is called to produce the default. Since "any non-function" is
> not expressible in Typed Racket, it's more restricted here.
>
> The best option is to wrap the third argument in a thunk: `(lambda () 
> 'other)`.
>
> As an aside, you probably don't want to use `cast` this extensively in
> your program.
>
> Sam
>
> On Tue, Apr 21, 2020 at 10:35 AM Hendrik Boom  
> wrote:
> >
> > In typed Racket I define a hashtable:
> >
> > (: vector-to-contract (HashTable TType CContract))
> >
> > (define vector-to-contract
> > (make-hash
> > (cast '(
> > (_bytes . bytes?)
> > (_s8vector . s8vector?)
> > (_u16vector . u16vector?)
> > (_s16vector . s16vector?)
> > (_u32vector . u32vector?)
> > (_s32vector . s32vector?)
> > (_u64vector . u64vector?)
> > (_s64vector . s64vector?)
> > (_f32vector . f32vector?)
> > (_f64vector . f64vector?))
> > (Listof (Pair TType CContract))
> > )
> > ))
> >
> > And then I try to look something up in it:
> >
> > ( hash-ref vector-to-contract (cast '_bytes TType) (cast 'other 
> CContract))
> >
> > and I am informed that I cannot, it seems, look up a value of type
> > TType in a hastable whose type indicates it looks up things of type
> > TType:
> >
> > Type Checker: Polymorphic function `hash-ref' could not be applied to 
> arguments:
> > Types: HashTableTop a (-> c) -> Any
> > HashTableTop a False -> Any
> > HashTableTop a -> Any
> > Arguments: (HashTable TType CContract) TType CContract
> > Expected result: AnyValues
> > in: (hash-ref vector-to-contract (cast (quote _bytes) TType) (cast
> > (quote other) CContract))
> >
> >
> > How *does* one use hashtables in typed Racket?
> >
> > -- hendrik
> >
> > --
> > 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...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/20200421143453.lauuqi3pb4fdgyhh%40topoi.pooq.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/aacb7226-8a0e-4fe0-9481-c1f72143eec2n%40googlegroups.com.


[racket-users] Linear algebra performance (was: calculations with arrays)

2020-11-24 Thread Dominik Pantůček
Hello,

> 
> If you are after numerical calculations for mxn matrices, then look at
> `flomat`
> which uses the same underlying C/Fortran library that NumPy uses.
> 
> https://docs.racket-lang.org/manual-flomat/index.html
> 
> If you need rrays with more dimensions than 2 use `math/array`.
> 
> If you need simple computation of 1-dimensional data, you can use
> standard Racket vectors (or flomats or arrays).

I didn't know about `flomat'. Thanks for (yet another) good hint.

However, for my project I needed really fast matrix multiplication (and
other basic linear algebra functions). It turned out that most of the
available options are sub-optimal at best. To my surprise `flomat` is
one of those.

Mostly I am concerned with 3D and 4D matrices and vectors.

During the past few months I hacked together a fairly optimized
module[1] for performing these operations that defines algebras for
given dimension during macro expansion stage and all the procedures are
constructed in a way that helps Racket (mainly CS) perform all
operations unboxed.

In the repository, there is a benchmark script, which yields the
following (self-explanatory) results:

 Welcome to Racket v7.9.0.5 [cs].

# 100 iterations

## flalgebra

mat3x3*mat3x3! cpu time: 13 real time: 13 gc time: 0
mat3x3*mat3x3 cpu time: 23 real time: 23 gc time: 4

## math/matrix

matrix*matrix cpu time: 55892 real time: 55911 gc time: 463

## math/typed/matrix

matrix*matrix cpu time: 6861 real time: 6862 gc time: 1045

## flomat

matrix*matrix! cpu time: 887 real time: 887 gc time: 4
matrix*matrix cpu time: 1825 real time: 1825 gc time: 7

 Welcome to Racket v7.9 [bc].

# 100 iterations

## flalgebra

mat3x3*mat3x3! cpu time: 145 real time: 145 gc time: 7
mat3x3*mat3x3 cpu time: 163 real time: 163 gc time: 2

## math/matrix

matrix*matrix cpu time: 53817 real time: 53788 gc time: 733

## math/typed/matrix

matrix*matrix cpu time: 3852 real time: 3851 gc time: 730

## flomat

matrix*matrix! cpu time: 745 real time: 745 gc time: 1
matrix*matrix cpu time: 1621 real time: 1620 gc time: 1


What puzzles me the most: when I read `flomat' documentation, I thought
it must beat my implementation by far margin - it's a native code for
really basic number crunching. When using the `times!' variant of matrix
multiplication, I would expect it to outperform anything implemented in
in pure Racket.

Is there something I miss or is it really the case, that carefully
crafted Racket implementation is the fastest option right now?

I actually wanted to write a similar email some time ago - in the spring
- about the typed math/matrix variant. But I was almost certain I am
doing something wrong and should figure it out. Now I am more and more
convinced that the performance of all number crunching libraries - as
they can be used in Racket - might be the real issue here.


Cheers,
Dominik

[1] https://gitlab.com/racketeer/flalgebra

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c94bf70d-1563-62d5-7632-bbaade7eb97f%40trustica.cz.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Matthew Flatt
The bottleneck for place startup is loading modules into the new place,
including modules like `racket/base`.

For example,

  (place-wait (dynamic-place 'racket 'void))

takes around 200ms on my machine, while

  (place-wait (dynamic-place 'racket/base 'void))

takes around 30ms and

  (place-wait (dynamic-place 'racket/kernel 'void))

takes around 10ms.

It sounds like you're already aware that the complexity of the module
loaded into a place matters, though. Beyond using a minimal set of
modules, I don't have any way to make place startup faster.

Matthew

At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
> Is there any way to make places startup faster? Even if i do an explicit
> round trip using place-channel-put and place-channel-get on both sides, it
> takes on the order of centiseconds for near empty places to start up.
> 
> My program requires the threads for a couple places to be set up before it
> can operate, so this impacts my startup time by quite a bit.
> 
> I have one place that has a very simple module and one place with a more
> complicated module. Is there some sequence that i should do things in for
> the minimal startup time? It seems nothing i do really helps much.
> 
> Nate
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7v
> m1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20201124071656.149%40sirmail.smtps.cs.utah.edu.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Nate Griswold
Oops, i am having some issues with not getting to the list from my other
email address. Here is a reply i sent for the record.

---

Thank you, Matthew.

The following code takes around 250ms on my machine. Any idea why? I was
expecting it to be fast since the module is based on racket/base.

#lang racket/base

(require syntax/location)
(require racket/place)


(module test racket/base
 (provide place-main)
racket
 (define (place-main pch)
  (void)))

(time (place-wait (dynamic-place (quote-module-path test) 'place-main)))

Nate


On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold 
wrote:

> Thank you, Matthew.
>
> The following code takes around 250ms on my machine. Any idea why? I was
> expecting it to be fast since the module is based on racket/base.
>
> #lang racket/base
>
> (require syntax/location)
> (require racket/place)
>
>
> (module test racket/base
>  (provide place-main)
> racket
>  (define (place-main pch)
>   (void)))
>
> (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
>
> Nate
>
> On Nov 24, 2020, at 8:16 AM, Matthew Flatt  wrote:
>
> The bottleneck for place startup is loading modules into the new place,
> including modules like `racket/base`.
>
> For example,
>
>  (place-wait (dynamic-place 'racket 'void))
>
> takes around 200ms on my machine, while
>
>  (place-wait (dynamic-place 'racket/base 'void))
>
> takes around 30ms and
>
>  (place-wait (dynamic-place 'racket/kernel 'void))
>
> takes around 10ms.
>
> It sounds like you're already aware that the complexity of the module
> loaded into a place matters, though. Beyond using a minimal set of
> modules, I don't have any way to make place startup faster.
>
> Matthew
>
> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
>
> Is there any way to make places startup faster? Even if i do an explicit
> round trip using place-channel-put and place-channel-get on both sides, it
> takes on the order of centiseconds for near empty places to start up.
>
> My program requires the threads for a couple places to be set up before it
> can operate, so this impacts my startup time by quite a bit.
>
> I have one place that has a very simple module and one place with a more
> complicated module. Is there some sequence that i should do things in for
> the minimal startup time? It seems nothing i do really helps much.
>
> Nate
>
> --
> 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.
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7v
> m1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPqtJrem4j%3DUi3fbrduoahsXCNNA2JPuB0Tt9dissiu5KA%40mail.gmail.com.


Re: [racket-users] snappier place startup time

2020-11-24 Thread 'Nathaniel W Griswold' via Racket Users
Thank you, Matthew.

The following code takes around 250ms on my machine. Any idea why? I was 
expecting it to be fast since the module is based on racket/base.

#lang racket/base

(require syntax/location)
(require racket/place)

(module test racket/base
 (provide place-main)
racket
 (define (place-main pch)
  (void)))

(time (place-wait (dynamic-place (quote-module-path test) 'place-main)))

Nate

> On Nov 24, 2020, at 8:16 AM, Matthew Flatt  wrote:
> 
> The bottleneck for place startup is loading modules into the new place,
> including modules like `racket/base`.
> 
> For example,
> 
>  (place-wait (dynamic-place 'racket 'void))
> 
> takes around 200ms on my machine, while
> 
>  (place-wait (dynamic-place 'racket/base 'void))
> 
> takes around 30ms and
> 
>  (place-wait (dynamic-place 'racket/kernel 'void))
> 
> takes around 10ms.
> 
> It sounds like you're already aware that the complexity of the module
> loaded into a place matters, though. Beyond using a minimal set of
> modules, I don't have any way to make place startup faster.
> 
> Matthew
> 
> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
>> Is there any way to make places startup faster? Even if i do an explicit
>> round trip using place-channel-put and place-channel-get on both sides, it
>> takes on the order of centiseconds for near empty places to start up.
>> 
>> My program requires the threads for a couple places to be set up before it
>> can operate, so this impacts my startup time by quite a bit.
>> 
>> I have one place that has a very simple module and one place with a more
>> complicated module. Is there some sequence that i should do things in for
>> the minimal startup time? It seems nothing i do really helps much.
>> 
>> Nate
>> 
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7v
>> m1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/DCF3799A-4064-4B2C-B0FC-5E76D2B78D4A%40manicmind.earth.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Sam Tobin-Hochstadt
Almost certainly the problem is expansion time. If I run that program
on my machine, it takes about 200 ms. But if I compile the file to zo
first with `raco make`, then it takes about 40 ms, basically identical
to `racket/base`.

Sam

On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold  wrote:
>
> Oops, i am having some issues with not getting to the list from my other 
> email address. Here is a reply i sent for the record.
>
> ---
>
> Thank you, Matthew.
>
> The following code takes around 250ms on my machine. Any idea why? I was 
> expecting it to be fast since the module is based on racket/base.
>
> #lang racket/base
>
> (require syntax/location)
> (require racket/place)
>
>
>
> (module test racket/base
>  (provide place-main)
> racket
>  (define (place-main pch)
>   (void)))
>
> (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
>
> Nate
>
>
> On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold  
> wrote:
>>
>> Thank you, Matthew.
>>
>> The following code takes around 250ms on my machine. Any idea why? I was 
>> expecting it to be fast since the module is based on racket/base.
>>
>> #lang racket/base
>>
>> (require syntax/location)
>> (require racket/place)
>>
>>
>>
>> (module test racket/base
>>  (provide place-main)
>> racket
>>  (define (place-main pch)
>>   (void)))
>>
>> (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
>>
>> Nate
>>
>> On Nov 24, 2020, at 8:16 AM, Matthew Flatt  wrote:
>>
>> The bottleneck for place startup is loading modules into the new place,
>> including modules like `racket/base`.
>>
>> For example,
>>
>>  (place-wait (dynamic-place 'racket 'void))
>>
>> takes around 200ms on my machine, while
>>
>>  (place-wait (dynamic-place 'racket/base 'void))
>>
>> takes around 30ms and
>>
>>  (place-wait (dynamic-place 'racket/kernel 'void))
>>
>> takes around 10ms.
>>
>> It sounds like you're already aware that the complexity of the module
>> loaded into a place matters, though. Beyond using a minimal set of
>> modules, I don't have any way to make place startup faster.
>>
>> Matthew
>>
>> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
>>
>> Is there any way to make places startup faster? Even if i do an explicit
>> round trip using place-channel-put and place-channel-get on both sides, it
>> takes on the order of centiseconds for near empty places to start up.
>>
>> My program requires the threads for a couple places to be set up before it
>> can operate, so this impacts my startup time by quite a bit.
>>
>> I have one place that has a very simple module and one place with a more
>> complicated module. Is there some sequence that i should do things in for
>> the minimal startup time? It seems nothing i do really helps much.
>>
>> Nate
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7v
>> m1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.
>>
>>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAM-xLPqtJrem4j%3DUi3fbrduoahsXCNNA2JPuB0Tt9dissiu5KA%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BY%2BEdpHVg8-AR4SHrLwNF2uZ6nBNpaCTwDx7NaFWpDprw%40mail.gmail.com.


Re: [racket-users] hash-ref in typed Racket

2020-11-24 Thread Sam Tobin-Hochstadt
Unfortunately, that doesn't work -- the values in the hash could
include functions.

Sam

On Tue, Nov 24, 2020 at 7:25 AM Tim Jervis  wrote:
>
> For the type of the third argument, rather than "any non-function", could 
> Typed Racket use the type of the values in the hash?
>
> On Tuesday, 21 April 2020 at 15:51:00 UTC+1 Sam Tobin-Hochstadt wrote:
>>
>> The problem here is with the optional third argument to `hash-ref`.
>> Typed Racket only allows `#f` or functions as the third argument.
>> Plain Racket allows any non-function value as a default, or a function
>> which is called to produce the default. Since "any non-function" is
>> not expressible in Typed Racket, it's more restricted here.
>>
>> The best option is to wrap the third argument in a thunk: `(lambda () 
>> 'other)`.
>>
>> As an aside, you probably don't want to use `cast` this extensively in
>> your program.
>>
>> Sam
>>
>> On Tue, Apr 21, 2020 at 10:35 AM Hendrik Boom  wrote:
>> >
>> > In typed Racket I define a hashtable:
>> >
>> > (: vector-to-contract (HashTable TType CContract))
>> >
>> > (define vector-to-contract
>> > (make-hash
>> > (cast '(
>> > (_bytes . bytes?)
>> > (_s8vector . s8vector?)
>> > (_u16vector . u16vector?)
>> > (_s16vector . s16vector?)
>> > (_u32vector . u32vector?)
>> > (_s32vector . s32vector?)
>> > (_u64vector . u64vector?)
>> > (_s64vector . s64vector?)
>> > (_f32vector . f32vector?)
>> > (_f64vector . f64vector?))
>> > (Listof (Pair TType CContract))
>> > )
>> > ))
>> >
>> > And then I try to look something up in it:
>> >
>> > ( hash-ref vector-to-contract (cast '_bytes TType) (cast 'other CContract))
>> >
>> > and I am informed that I cannot, it seems, look up a value of type
>> > TType in a hastable whose type indicates it looks up things of type
>> > TType:
>> >
>> > Type Checker: Polymorphic function `hash-ref' could not be applied to 
>> > arguments:
>> > Types: HashTableTop a (-> c) -> Any
>> > HashTableTop a False -> Any
>> > HashTableTop a -> Any
>> > Arguments: (HashTable TType CContract) TType CContract
>> > Expected result: AnyValues
>> > in: (hash-ref vector-to-contract (cast (quote _bytes) TType) (cast
>> > (quote other) CContract))
>> >
>> >
>> > How *does* one use hashtables in typed Racket?
>> >
>> > -- hendrik
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/racket-users/20200421143453.lauuqi3pb4fdgyhh%40topoi.pooq.com.
>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/aacb7226-8a0e-4fe0-9481-c1f72143eec2n%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BZZU4mNFX1XnfFXYxHjv8baaPw%3DZ%3D-ArO4tNhE%3D7VKqzQ%40mail.gmail.com.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Nate Griswold
Awesome, thanks!

Nate


On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt 
wrote:

> Almost certainly the problem is expansion time. If I run that program
> on my machine, it takes about 200 ms. But if I compile the file to zo
> first with `raco make`, then it takes about 40 ms, basically identical
> to `racket/base`.
>
> Sam
>
> On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold 
> wrote:
> >
> > Oops, i am having some issues with not getting to the list from my other
> email address. Here is a reply i sent for the record.
> >
> > ---
> >
> > Thank you, Matthew.
> >
> > The following code takes around 250ms on my machine. Any idea why? I was
> expecting it to be fast since the module is based on racket/base.
> >
> > #lang racket/base
> >
> > (require syntax/location)
> > (require racket/place)
> >
> >
> >
> > (module test racket/base
> >  (provide place-main)
> > racket
> >  (define (place-main pch)
> >   (void)))
> >
> > (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
> >
> > Nate
> >
> >
> > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
>  wrote:
> >>
> >> Thank you, Matthew.
> >>
> >> The following code takes around 250ms on my machine. Any idea why? I
> was expecting it to be fast since the module is based on racket/base.
> >>
> >> #lang racket/base
> >>
> >> (require syntax/location)
> >> (require racket/place)
> >>
> >>
> >>
> >> (module test racket/base
> >>  (provide place-main)
> >> racket
> >>  (define (place-main pch)
> >>   (void)))
> >>
> >> (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
> >>
> >> Nate
> >>
> >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt  wrote:
> >>
> >> The bottleneck for place startup is loading modules into the new place,
> >> including modules like `racket/base`.
> >>
> >> For example,
> >>
> >>  (place-wait (dynamic-place 'racket 'void))
> >>
> >> takes around 200ms on my machine, while
> >>
> >>  (place-wait (dynamic-place 'racket/base 'void))
> >>
> >> takes around 30ms and
> >>
> >>  (place-wait (dynamic-place 'racket/kernel 'void))
> >>
> >> takes around 10ms.
> >>
> >> It sounds like you're already aware that the complexity of the module
> >> loaded into a place matters, though. Beyond using a minimal set of
> >> modules, I don't have any way to make place startup faster.
> >>
> >> Matthew
> >>
> >> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
> >>
> >> Is there any way to make places startup faster? Even if i do an explicit
> >> round trip using place-channel-put and place-channel-get on both sides,
> it
> >> takes on the order of centiseconds for near empty places to start up.
> >>
> >> My program requires the threads for a couple places to be set up before
> it
> >> can operate, so this impacts my startup time by quite a bit.
> >>
> >> I have one place that has a very simple module and one place with a more
> >> complicated module. Is there some sequence that i should do things in
> for
> >> the minimal startup time? It seems nothing i do really helps much.
> >>
> >> Nate
> >>
> >> --
> >> 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.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7v
> >> m1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.
> >>
> >>
> > --
> > 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.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAM-xLPqtJrem4j%3DUi3fbrduoahsXCNNA2JPuB0Tt9dissiu5KA%40mail.gmail.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPqVgEBvrRzjU7%3DX_h3Wy_YUH11G6CX5%2BKjSct26pi3oEA%40mail.gmail.com.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Matthew Flatt
Just to elaborate a little more:

The difference is because the `test` submodule can be loaded
independently from the compiled form. Loading the submodule from source
requires loading the enclosing module, too (which depends on
`racket/place` and more).

At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
> Awesome, thanks!
> 
> Nate
> 
> 
> On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt 
> wrote:
> 
> > Almost certainly the problem is expansion time. If I run that program
> > on my machine, it takes about 200 ms. But if I compile the file to zo
> > first with `raco make`, then it takes about 40 ms, basically identical
> > to `racket/base`.
> >
> > Sam
> >
> > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold 
> > wrote:
> > >
> > > Oops, i am having some issues with not getting to the list from my other
> > email address. Here is a reply i sent for the record.
> > >
> > > ---
> > >
> > > Thank you, Matthew.
> > >
> > > The following code takes around 250ms on my machine. Any idea why? I was
> > expecting it to be fast since the module is based on racket/base.
> > >
> > > #lang racket/base
> > >
> > > (require syntax/location)
> > > (require racket/place)
> > >
> > >
> > >
> > > (module test racket/base
> > >  (provide place-main)
> > > racket
> > >  (define (place-main pch)
> > >   (void)))
> > >
> > > (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
> > >
> > > Nate
> > >
> > >
> > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
> >  wrote:
> > >>
> > >> Thank you, Matthew.
> > >>
> > >> The following code takes around 250ms on my machine. Any idea why? I
> > was expecting it to be fast since the module is based on racket/base.
> > >>
> > >> #lang racket/base
> > >>
> > >> (require syntax/location)
> > >> (require racket/place)
> > >>
> > >>
> > >>
> > >> (module test racket/base
> > >>  (provide place-main)
> > >> racket
> > >>  (define (place-main pch)
> > >>   (void)))
> > >>
> > >> (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
> > >>
> > >> Nate
> > >>
> > >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt  wrote:
> > >>
> > >> The bottleneck for place startup is loading modules into the new place,
> > >> including modules like `racket/base`.
> > >>
> > >> For example,
> > >>
> > >>  (place-wait (dynamic-place 'racket 'void))
> > >>
> > >> takes around 200ms on my machine, while
> > >>
> > >>  (place-wait (dynamic-place 'racket/base 'void))
> > >>
> > >> takes around 30ms and
> > >>
> > >>  (place-wait (dynamic-place 'racket/kernel 'void))
> > >>
> > >> takes around 10ms.
> > >>
> > >> It sounds like you're already aware that the complexity of the module
> > >> loaded into a place matters, though. Beyond using a minimal set of
> > >> modules, I don't have any way to make place startup faster.
> > >>
> > >> Matthew
> > >>
> > >> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
> > >>
> > >> Is there any way to make places startup faster? Even if i do an explicit
> > >> round trip using place-channel-put and place-channel-get on both sides,
> > it
> > >> takes on the order of centiseconds for near empty places to start up.
> > >>
> > >> My program requires the threads for a couple places to be set up before
> > it
> > >> can operate, so this impacts my startup time by quite a bit.
> > >>
> > >> I have one place that has a very simple module and one place with a more
> > >> complicated module. Is there some sequence that i should do things in
> > for
> > >> the minimal startup time? It seems nothing i do really helps much.
> > >>
> > >> Nate
> > >>
> > >> --
> > >> 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.
> > >> To view this discussion on the web visit
> > >>
> > 
> https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7v
> > >> m1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.
> > >>
> > >>
> > > --
> > > 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.
> > > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/racket-users/CAM-xLPqtJrem4j%3DUi3fbrduoahsXC
> NNA2JPuB0Tt9dissiu5KA%40mail.gmail.com
> > .
> >
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAM-xLPqVgEBvrRzjU7%3DX_h3Wy_YUH
> 11G6CX5%2BKjSct26pi3oEA%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group

Re: [racket-users] snappier place startup time

2020-11-24 Thread Nate Griswold
Oh, interesting. So compilation breaks the submodule out from the modules
if possible?

So anyway, it sounds like breaking my modules out into separate files will
improve performance in most cases.

Unfortunately, i need racket/place in the module that is my startup
bottleneck. If i modify the previous program to require racket/place and
compile, it takes around 180ms.

This is about what i can expect for a module that requires racket/place,
then?

Nate


On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt  wrote:

> Just to elaborate a little more:
>
> The difference is because the `test` submodule can be loaded
> independently from the compiled form. Loading the submodule from source
> requires loading the enclosing module, too (which depends on
> `racket/place` and more).
>
> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
> > Awesome, thanks!
> >
> > Nate
> >
> >
> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt <
> sa...@cs.indiana.edu>
> > wrote:
> >
> > > Almost certainly the problem is expansion time. If I run that program
> > > on my machine, it takes about 200 ms. But if I compile the file to zo
> > > first with `raco make`, then it takes about 40 ms, basically identical
> > > to `racket/base`.
> > >
> > > Sam
> > >
> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold 
> > > wrote:
> > > >
> > > > Oops, i am having some issues with not getting to the list from my
> other
> > > email address. Here is a reply i sent for the record.
> > > >
> > > > ---
> > > >
> > > > Thank you, Matthew.
> > > >
> > > > The following code takes around 250ms on my machine. Any idea why? I
> was
> > > expecting it to be fast since the module is based on racket/base.
> > > >
> > > > #lang racket/base
> > > >
> > > > (require syntax/location)
> > > > (require racket/place)
> > > >
> > > >
> > > >
> > > > (module test racket/base
> > > >  (provide place-main)
> > > > racket
> > > >  (define (place-main pch)
> > > >   (void)))
> > > >
> > > > (time (place-wait (dynamic-place (quote-module-path test)
> 'place-main)))
> > > >
> > > > Nate
> > > >
> > > >
> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
> > >  wrote:
> > > >>
> > > >> Thank you, Matthew.
> > > >>
> > > >> The following code takes around 250ms on my machine. Any idea why? I
> > > was expecting it to be fast since the module is based on racket/base.
> > > >>
> > > >> #lang racket/base
> > > >>
> > > >> (require syntax/location)
> > > >> (require racket/place)
> > > >>
> > > >>
> > > >>
> > > >> (module test racket/base
> > > >>  (provide place-main)
> > > >> racket
> > > >>  (define (place-main pch)
> > > >>   (void)))
> > > >>
> > > >> (time (place-wait (dynamic-place (quote-module-path test)
> 'place-main)))
> > > >>
> > > >> Nate
> > > >>
> > > >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt 
> wrote:
> > > >>
> > > >> The bottleneck for place startup is loading modules into the new
> place,
> > > >> including modules like `racket/base`.
> > > >>
> > > >> For example,
> > > >>
> > > >>  (place-wait (dynamic-place 'racket 'void))
> > > >>
> > > >> takes around 200ms on my machine, while
> > > >>
> > > >>  (place-wait (dynamic-place 'racket/base 'void))
> > > >>
> > > >> takes around 30ms and
> > > >>
> > > >>  (place-wait (dynamic-place 'racket/kernel 'void))
> > > >>
> > > >> takes around 10ms.
> > > >>
> > > >> It sounds like you're already aware that the complexity of the
> module
> > > >> loaded into a place matters, though. Beyond using a minimal set of
> > > >> modules, I don't have any way to make place startup faster.
> > > >>
> > > >> Matthew
> > > >>
> > > >> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
> > > >>
> > > >> Is there any way to make places startup faster? Even if i do an
> explicit
> > > >> round trip using place-channel-put and place-channel-get on both
> sides,
> > > it
> > > >> takes on the order of centiseconds for near empty places to start
> up.
> > > >>
> > > >> My program requires the threads for a couple places to be set up
> before
> > > it
> > > >> can operate, so this impacts my startup time by quite a bit.
> > > >>
> > > >> I have one place that has a very simple module and one place with a
> more
> > > >> complicated module. Is there some sequence that i should do things
> in
> > > for
> > > >> the minimal startup time? It seems nothing i do really helps much.
> > > >>
> > > >> Nate
> > > >>
> > > >> --
> > > >> 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.
> > > >> To view this discussion on the web visit
> > > >>
> > >
> >
> https://groups.google.com/d/msgid/racket-users/CAM-xLPpvfCHHDDpfNmuTWQOyfYfEJ7v
> > > >> m1c_dS7nj3FxaEFVm2Q%40mail.gmail.com.
> > > >>
> > > >>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > Groups "Racket Users

[racket-users] Messages going to spam?

2020-11-24 Thread Nate Griswold
No rush but can an admin for the list check if my messages from my other
email are being flagged suspicious? The other email is nate@manicmind.earth.
I don't want to use my gmail account.

Sorry if there is a better place to ask this.

Nate

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPoQ6uv_w%3Dtsz%3DD8uXfEhysfano9ZRBFo1CxNNtHN8zTrQ%40mail.gmail.com.


Re: [racket-users] Messages going to spam?

2020-11-24 Thread Nate Griswold
Thanks, Sam. That is what i wanted.

Is there any way to allow all messages from that account from now on?

Nate


On Tue, Nov 24, 2020 at 9:08 AM Sam Tobin-Hochstadt 
wrote:

> Yes, those messages have been going to spam. I didn't approve them
> separately since I just saw the notification and you had already
> posted them with your gmail account.
>
> Sam
>
> On Tue, Nov 24, 2020 at 9:59 AM Nate Griswold 
> wrote:
> >
> > No rush but can an admin for the list check if my messages from my other
> email are being flagged suspicious? The other email is nate@manicmind.earth.
> I don't want to use my gmail account.
> >
> > Sorry if there is a better place to ask this.
> >
> > Nate
> >
> > --
> > 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.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAM-xLPoQ6uv_w%3Dtsz%3DD8uXfEhysfano9ZRBFo1CxNNtHN8zTrQ%40mail.gmail.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPrBDaWoVsBU9TGELtrX0MCNYUf_ctwH1GHNEWMjE4aG-Q%40mail.gmail.com.


Re: [racket-users] hash-ref in typed Racket

2020-11-24 Thread Tim Jervis
Wouldn’t that possibility then have to be part of the type for the values in 
the hash? Maybe I don’t understand how types work for hashes.

In this code:

#lang typed/racket

(define h : (Immutable-HashTable Integer (-> String))
  (make-immutable-hash))

(hash-ref h
  2
  (thunk "Hit and miss"))

I think I’ve set the type of the values of the hash h to be a thunk that 
returns a string. I’m then trying to access a key in that hash, which misses 
because the hash has no keys. The third argument works because it’s a function 
that happens to return a string. It’s funny because it looks like it 
type-checks, but it doesn’t really.

This code:

#lang typed/racket

(define h : (Immutable-HashTable Integer String)
  (make-immutable-hash))

(hash-ref h
  2
  (thunk "Hit and miss"))

also type-checks because even though the third argument to hash-ref is not a 
String, it is a function.

Oddly, to me at least,

#lang typed/racket

(define h : (Immutable-HashTable Integer String)
  (make-immutable-hash))

(hash-ref h
  2
  "Hit and miss")

Does not type check even though the type of the hash’s values is String, the 
same as the third argument of hash-ref.

> On 24 Nov 2020, at 14:44, Sam Tobin-Hochstadt  wrote:
> 
> Unfortunately, that doesn't work -- the values in the hash could
> include functions.
> 
> Sam
> 
> On Tue, Nov 24, 2020 at 7:25 AM Tim Jervis  wrote:
>> 
>> For the type of the third argument, rather than "any non-function", could 
>> Typed Racket use the type of the values in the hash?
>> 
>> On Tuesday, 21 April 2020 at 15:51:00 UTC+1 Sam Tobin-Hochstadt wrote:
>>> 
>>> The problem here is with the optional third argument to `hash-ref`.
>>> Typed Racket only allows `#f` or functions as the third argument.
>>> Plain Racket allows any non-function value as a default, or a function
>>> which is called to produce the default. Since "any non-function" is
>>> not expressible in Typed Racket, it's more restricted here.
>>> 
>>> The best option is to wrap the third argument in a thunk: `(lambda () 
>>> 'other)`.
>>> 
>>> As an aside, you probably don't want to use `cast` this extensively in
>>> your program.
>>> 
>>> Sam
>>> 
>>> On Tue, Apr 21, 2020 at 10:35 AM Hendrik Boom  wrote:
 
 In typed Racket I define a hashtable:
 
 (: vector-to-contract (HashTable TType CContract))
 
 (define vector-to-contract
 (make-hash
 (cast '(
 (_bytes . bytes?)
 (_s8vector . s8vector?)
 (_u16vector . u16vector?)
 (_s16vector . s16vector?)
 (_u32vector . u32vector?)
 (_s32vector . s32vector?)
 (_u64vector . u64vector?)
 (_s64vector . s64vector?)
 (_f32vector . f32vector?)
 (_f64vector . f64vector?))
 (Listof (Pair TType CContract))
 )
 ))
 
 And then I try to look something up in it:
 
 ( hash-ref vector-to-contract (cast '_bytes TType) (cast 'other CContract))
 
 and I am informed that I cannot, it seems, look up a value of type
 TType in a hastable whose type indicates it looks up things of type
 TType:
 
 Type Checker: Polymorphic function `hash-ref' could not be applied to 
 arguments:
 Types: HashTableTop a (-> c) -> Any
 HashTableTop a False -> Any
 HashTableTop a -> Any
 Arguments: (HashTable TType CContract) TType CContract
 Expected result: AnyValues
 in: (hash-ref vector-to-contract (cast (quote _bytes) TType) (cast
 (quote other) CContract))
 
 
 How *does* one use hashtables in typed Racket?
 
 -- hendrik
 
 --
 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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/racket-users/20200421143453.lauuqi3pb4fdgyhh%40topoi.pooq.com.
>> 
>> --
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/aacb7226-8a0e-4fe0-9481-c1f72143eec2n%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/2B6A277A-5538-4FFB-86E7-48F3D663C90D%40gmail.com.


Re: [racket-users] Messages going to spam?

2020-11-24 Thread Robby Findler
I might have approved one (and when I did I also marked the email address
is came from as always allowed to post so hopefully it won't happen again).

Robby


On Tue, Nov 24, 2020 at 9:16 AM Nate Griswold 
wrote:

> Thanks, Sam. That is what i wanted.
>
> Is there any way to allow all messages from that account from now on?
>
> Nate
>
>
> On Tue, Nov 24, 2020 at 9:08 AM Sam Tobin-Hochstadt 
> wrote:
>
>> Yes, those messages have been going to spam. I didn't approve them
>> separately since I just saw the notification and you had already
>> posted them with your gmail account.
>>
>> Sam
>>
>> On Tue, Nov 24, 2020 at 9:59 AM Nate Griswold 
>> wrote:
>> >
>> > No rush but can an admin for the list check if my messages from my
>> other email are being flagged suspicious? The other email is
>> nate@manicmind.earth. I don't want to use my gmail account.
>> >
>> > Sorry if there is a better place to ask this.
>> >
>> > Nate
>> >
>> > --
>> > 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.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/CAM-xLPoQ6uv_w%3Dtsz%3DD8uXfEhysfano9ZRBFo1CxNNtHN8zTrQ%40mail.gmail.com
>> .
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAM-xLPrBDaWoVsBU9TGELtrX0MCNYUf_ctwH1GHNEWMjE4aG-Q%40mail.gmail.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOND3HwbpaeEJG_AEmauH_-hewhJ4mHt%3Dqm3VOM-x8ZqVw%40mail.gmail.com.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Robby Findler
DrRacket thinks that there are no references to a number of the requires in
racket/place, including racket/fixnum, racket/flonum, racket/vector, and
racket/runtime-path. Not sure if that's an error on DrRacket's part (and I
don't see why those would be needed for their effects).

Also, the only use of racket/match seems to be this, which seems simple to
rewrite out.

(match name
  [(? symbol?) `(submod (quote ,name) ,submod-name)]
  [(? path?) `(submod ,name ,submod-name)]
  [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s
,submod-name)])

Robby


On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold 
wrote:

> Oh, interesting. So compilation breaks the submodule out from the modules
> if possible?
>
> So anyway, it sounds like breaking my modules out into separate files will
> improve performance in most cases.
>
> Unfortunately, i need racket/place in the module that is my startup
> bottleneck. If i modify the previous program to require racket/place and
> compile, it takes around 180ms.
>
> This is about what i can expect for a module that requires racket/place,
> then?
>
> Nate
>
>
> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt  wrote:
>
>> Just to elaborate a little more:
>>
>> The difference is because the `test` submodule can be loaded
>> independently from the compiled form. Loading the submodule from source
>> requires loading the enclosing module, too (which depends on
>> `racket/place` and more).
>>
>> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
>> > Awesome, thanks!
>> >
>> > Nate
>> >
>> >
>> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt <
>> sa...@cs.indiana.edu>
>> > wrote:
>> >
>> > > Almost certainly the problem is expansion time. If I run that program
>> > > on my machine, it takes about 200 ms. But if I compile the file to zo
>> > > first with `raco make`, then it takes about 40 ms, basically identical
>> > > to `racket/base`.
>> > >
>> > > Sam
>> > >
>> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold > >
>> > > wrote:
>> > > >
>> > > > Oops, i am having some issues with not getting to the list from my
>> other
>> > > email address. Here is a reply i sent for the record.
>> > > >
>> > > > ---
>> > > >
>> > > > Thank you, Matthew.
>> > > >
>> > > > The following code takes around 250ms on my machine. Any idea why?
>> I was
>> > > expecting it to be fast since the module is based on racket/base.
>> > > >
>> > > > #lang racket/base
>> > > >
>> > > > (require syntax/location)
>> > > > (require racket/place)
>> > > >
>> > > >
>> > > >
>> > > > (module test racket/base
>> > > >  (provide place-main)
>> > > > racket
>> > > >  (define (place-main pch)
>> > > >   (void)))
>> > > >
>> > > > (time (place-wait (dynamic-place (quote-module-path test)
>> 'place-main)))
>> > > >
>> > > > Nate
>> > > >
>> > > >
>> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
>> > >  wrote:
>> > > >>
>> > > >> Thank you, Matthew.
>> > > >>
>> > > >> The following code takes around 250ms on my machine. Any idea why?
>> I
>> > > was expecting it to be fast since the module is based on racket/base.
>> > > >>
>> > > >> #lang racket/base
>> > > >>
>> > > >> (require syntax/location)
>> > > >> (require racket/place)
>> > > >>
>> > > >>
>> > > >>
>> > > >> (module test racket/base
>> > > >>  (provide place-main)
>> > > >> racket
>> > > >>  (define (place-main pch)
>> > > >>   (void)))
>> > > >>
>> > > >> (time (place-wait (dynamic-place (quote-module-path test)
>> 'place-main)))
>> > > >>
>> > > >> Nate
>> > > >>
>> > > >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt 
>> wrote:
>> > > >>
>> > > >> The bottleneck for place startup is loading modules into the new
>> place,
>> > > >> including modules like `racket/base`.
>> > > >>
>> > > >> For example,
>> > > >>
>> > > >>  (place-wait (dynamic-place 'racket 'void))
>> > > >>
>> > > >> takes around 200ms on my machine, while
>> > > >>
>> > > >>  (place-wait (dynamic-place 'racket/base 'void))
>> > > >>
>> > > >> takes around 30ms and
>> > > >>
>> > > >>  (place-wait (dynamic-place 'racket/kernel 'void))
>> > > >>
>> > > >> takes around 10ms.
>> > > >>
>> > > >> It sounds like you're already aware that the complexity of the
>> module
>> > > >> loaded into a place matters, though. Beyond using a minimal set of
>> > > >> modules, I don't have any way to make place startup faster.
>> > > >>
>> > > >> Matthew
>> > > >>
>> > > >> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
>> > > >>
>> > > >> Is there any way to make places startup faster? Even if i do an
>> explicit
>> > > >> round trip using place-channel-put and place-channel-get on both
>> sides,
>> > > it
>> > > >> takes on the order of centiseconds for near empty places to start
>> up.
>> > > >>
>> > > >> My program requires the threads for a couple places to be set up
>> before
>> > > it
>> > > >> can operate, so this impacts my startup time by quite a bit.
>> > > >>
>> > > >> I have one place that has a very simple module and one place with
>> a more
>> > > >> co

Re: [racket-users] Messages going to spam?

2020-11-24 Thread Nate Griswold
Hm, ok. It looks like the messages still aren't going through It might be
since i unadded and readded myself at one point. I just sent another so
that might be approvable.

Nate


On Tue, Nov 24, 2020 at 9:48 AM Robby Findler 
wrote:

> I might have approved one (and when I did I also marked the email address
> is came from as always allowed to post so hopefully it won't happen again).
>
> Robby
>
>
> On Tue, Nov 24, 2020 at 9:16 AM Nate Griswold 
> wrote:
>
>> Thanks, Sam. That is what i wanted.
>>
>> Is there any way to allow all messages from that account from now on?
>>
>> Nate
>>
>>
>> On Tue, Nov 24, 2020 at 9:08 AM Sam Tobin-Hochstadt 
>> wrote:
>>
>>> Yes, those messages have been going to spam. I didn't approve them
>>> separately since I just saw the notification and you had already
>>> posted them with your gmail account.
>>>
>>> Sam
>>>
>>> On Tue, Nov 24, 2020 at 9:59 AM Nate Griswold 
>>> wrote:
>>> >
>>> > No rush but can an admin for the list check if my messages from my
>>> other email are being flagged suspicious? The other email is
>>> nate@manicmind.earth. I don't want to use my gmail account.
>>> >
>>> > Sorry if there is a better place to ask this.
>>> >
>>> > Nate
>>> >
>>> > --
>>> > 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.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/racket-users/CAM-xLPoQ6uv_w%3Dtsz%3DD8uXfEhysfano9ZRBFo1CxNNtHN8zTrQ%40mail.gmail.com
>>> .
>>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/CAM-xLPrBDaWoVsBU9TGELtrX0MCNYUf_ctwH1GHNEWMjE4aG-Q%40mail.gmail.com
>> 
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPrszCZ2c%2BEVZrJPHdg%2BDWp4%3DkcFuh%2BoSg5a-1vm5613Ew%40mail.gmail.com.


Re: [racket-users] snappier place startup time

2020-11-24 Thread 'Nathaniel W Griswold' via Racket Users
Cool. If this is indeed the case it might be nice for someone (maybe me) to cut 
it down, since any nontrivial place will of course require racket/place and 
that is kind of a long time.

Nate

> On Nov 24, 2020, at 9:52 AM, Robby Findler  wrote:
> 
> DrRacket thinks that there are no references to a number of the requires in 
> racket/place, including racket/fixnum, racket/flonum, racket/vector, and 
> racket/runtime-path. Not sure if that's an error on DrRacket's part (and I 
> don't see why those would be needed for their effects).
> 
> Also, the only use of racket/match seems to be this, which seems simple to 
> rewrite out.
> 
> (match name
>   [(? symbol?) `(submod (quote ,name) ,submod-name)]
>   [(? path?) `(submod ,name ,submod-name)]
>   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s 
> ,submod-name)])
> 
> Robby
> 
> 
> On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold  > wrote:
> Oh, interesting. So compilation breaks the submodule out from the modules if 
> possible?
> 
> So anyway, it sounds like breaking my modules out into separate files will 
> improve performance in most cases.
> 
> Unfortunately, i need racket/place in the module that is my startup 
> bottleneck. If i modify the previous program to require racket/place and 
> compile, it takes around 180ms.
> 
> This is about what i can expect for a module that requires racket/place, then?
> 
> Nate
> 
> 
> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt  > wrote:
> Just to elaborate a little more:
> 
> The difference is because the `test` submodule can be loaded
> independently from the compiled form. Loading the submodule from source
> requires loading the enclosing module, too (which depends on
> `racket/place` and more).
> 
> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
> > Awesome, thanks!
> > 
> > Nate
> > 
> > 
> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt  > >
> > wrote:
> > 
> > > Almost certainly the problem is expansion time. If I run that program
> > > on my machine, it takes about 200 ms. But if I compile the file to zo
> > > first with `raco make`, then it takes about 40 ms, basically identical
> > > to `racket/base`.
> > >
> > > Sam
> > >
> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold  > > >
> > > wrote:
> > > >
> > > > Oops, i am having some issues with not getting to the list from my other
> > > email address. Here is a reply i sent for the record.
> > > >
> > > > ---
> > > >
> > > > Thank you, Matthew.
> > > >
> > > > The following code takes around 250ms on my machine. Any idea why? I was
> > > expecting it to be fast since the module is based on racket/base.
> > > >
> > > > #lang racket/base
> > > >
> > > > (require syntax/location)
> > > > (require racket/place)
> > > >
> > > >
> > > >
> > > > (module test racket/base
> > > >  (provide place-main)
> > > > racket
> > > >  (define (place-main pch)
> > > >   (void)))
> > > >
> > > > (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
> > > >
> > > > Nate
> > > >
> > > >
> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
> > >  wrote:
> > > >>
> > > >> Thank you, Matthew.
> > > >>
> > > >> The following code takes around 250ms on my machine. Any idea why? I
> > > was expecting it to be fast since the module is based on racket/base.
> > > >>
> > > >> #lang racket/base
> > > >>
> > > >> (require syntax/location)
> > > >> (require racket/place)
> > > >>
> > > >>
> > > >>
> > > >> (module test racket/base
> > > >>  (provide place-main)
> > > >> racket
> > > >>  (define (place-main pch)
> > > >>   (void)))
> > > >>
> > > >> (time (place-wait (dynamic-place (quote-module-path test) 
> > > >> 'place-main)))
> > > >>
> > > >> Nate
> > > >>
> > > >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt  > > >> > wrote:
> > > >>
> > > >> The bottleneck for place startup is loading modules into the new place,
> > > >> including modules like `racket/base`.
> > > >>
> > > >> For example,
> > > >>
> > > >>  (place-wait (dynamic-place 'racket 'void))
> > > >>
> > > >> takes around 200ms on my machine, while
> > > >>
> > > >>  (place-wait (dynamic-place 'racket/base 'void))
> > > >>
> > > >> takes around 30ms and
> > > >>
> > > >>  (place-wait (dynamic-place 'racket/kernel 'void))
> > > >>
> > > >> takes around 10ms.
> > > >>
> > > >> It sounds like you're already aware that the complexity of the module
> > > >> loaded into a place matters, though. Beyond using a minimal set of
> > > >> modules, I don't have any way to make place startup faster.
> > > >>
> > > >> Matthew
> > > >>
> > > >> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
> > > >>
> > > >> Is there any way to make places startup faster? Even if i do an 
> > > >> explicit
> > > >> round trip using place-channel-put and place-channel-get on both sides,
> > > it
> > > >> takes on the order of centiseconds f

Re: [racket-users] snappier place startup time

2020-11-24 Thread Robby Findler
I didn't check to see if removing those has a significant performance
effect, but the remaining requires seem pretty minimal.

Robby


On Tue, Nov 24, 2020 at 10:26 AM 'Nathaniel W Griswold' via Racket Users <
racket-users@googlegroups.com> wrote:

> Cool. If this is indeed the case it might be nice for someone (maybe me)
> to cut it down, since any nontrivial place will of course require
> racket/place and that is kind of a long time.
>
> Nate
>
> On Nov 24, 2020, at 9:52 AM, Robby Findler 
> wrote:
>
> DrRacket thinks that there are no references to a number of the requires
> in racket/place, including racket/fixnum, racket/flonum, racket/vector, and
> racket/runtime-path. Not sure if that's an error on DrRacket's part (and I
> don't see why those would be needed for their effects).
>
> Also, the only use of racket/match seems to be this, which seems simple to
> rewrite out.
>
> (match name
>   [(? symbol?) `(submod (quote ,name) ,submod-name)]
>   [(? path?) `(submod ,name ,submod-name)]
>   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s
> ,submod-name)])
>
> Robby
>
>
> On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold 
> wrote:
>
>> Oh, interesting. So compilation breaks the submodule out from the modules
>> if possible?
>>
>> So anyway, it sounds like breaking my modules out into separate files
>> will improve performance in most cases.
>>
>> Unfortunately, i need racket/place in the module that is my startup
>> bottleneck. If i modify the previous program to require racket/place and
>> compile, it takes around 180ms.
>>
>> This is about what i can expect for a module that requires racket/place,
>> then?
>>
>> Nate
>>
>>
>> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt  wrote:
>>
>>> Just to elaborate a little more:
>>>
>>> The difference is because the `test` submodule can be loaded
>>> independently from the compiled form. Loading the submodule from source
>>> requires loading the enclosing module, too (which depends on
>>> `racket/place` and more).
>>>
>>> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
>>> > Awesome, thanks!
>>> >
>>> > Nate
>>> >
>>> >
>>> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt <
>>> sa...@cs.indiana.edu>
>>> > wrote:
>>> >
>>> > > Almost certainly the problem is expansion time. If I run that program
>>> > > on my machine, it takes about 200 ms. But if I compile the file to zo
>>> > > first with `raco make`, then it takes about 40 ms, basically
>>> identical
>>> > > to `racket/base`.
>>> > >
>>> > > Sam
>>> > >
>>> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold <
>>> nategrisw...@gmail.com>
>>> > > wrote:
>>> > > >
>>> > > > Oops, i am having some issues with not getting to the list from my
>>> other
>>> > > email address. Here is a reply i sent for the record.
>>> > > >
>>> > > > ---
>>> > > >
>>> > > > Thank you, Matthew.
>>> > > >
>>> > > > The following code takes around 250ms on my machine. Any idea why?
>>> I was
>>> > > expecting it to be fast since the module is based on racket/base.
>>> > > >
>>> > > > #lang racket/base
>>> > > >
>>> > > > (require syntax/location)
>>> > > > (require racket/place)
>>> > > >
>>> > > >
>>> > > >
>>> > > > (module test racket/base
>>> > > >  (provide place-main)
>>> > > > racket
>>> > > >  (define (place-main pch)
>>> > > >   (void)))
>>> > > >
>>> > > > (time (place-wait (dynamic-place (quote-module-path test)
>>> 'place-main)))
>>> > > >
>>> > > > Nate
>>> > > >
>>> > > >
>>> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
>>> > >  wrote:
>>> > > >>
>>> > > >> Thank you, Matthew.
>>> > > >>
>>> > > >> The following code takes around 250ms on my machine. Any idea
>>> why? I
>>> > > was expecting it to be fast since the module is based on racket/base.
>>> > > >>
>>> > > >> #lang racket/base
>>> > > >>
>>> > > >> (require syntax/location)
>>> > > >> (require racket/place)
>>> > > >>
>>> > > >>
>>> > > >>
>>> > > >> (module test racket/base
>>> > > >>  (provide place-main)
>>> > > >> racket
>>> > > >>  (define (place-main pch)
>>> > > >>   (void)))
>>> > > >>
>>> > > >> (time (place-wait (dynamic-place (quote-module-path test)
>>> 'place-main)))
>>> > > >>
>>> > > >> Nate
>>> > > >>
>>> > > >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt 
>>> wrote:
>>> > > >>
>>> > > >> The bottleneck for place startup is loading modules into the new
>>> place,
>>> > > >> including modules like `racket/base`.
>>> > > >>
>>> > > >> For example,
>>> > > >>
>>> > > >>  (place-wait (dynamic-place 'racket 'void))
>>> > > >>
>>> > > >> takes around 200ms on my machine, while
>>> > > >>
>>> > > >>  (place-wait (dynamic-place 'racket/base 'void))
>>> > > >>
>>> > > >> takes around 30ms and
>>> > > >>
>>> > > >>  (place-wait (dynamic-place 'racket/kernel 'void))
>>> > > >>
>>> > > >> takes around 10ms.
>>> > > >>
>>> > > >> It sounds like you're already aware that the complexity of the
>>> module
>>> > > >> loaded into a place matters, though. Beyond using a minimal set of
>>> > > >> modules, I don't have a

Re: [racket-users] Linear algebra performance (was: calculations with arrays)

2020-11-24 Thread Jens Axel Søgaard
Den tir. 24. nov. 2020 kl. 15.12 skrev Dominik Pantůček <
dominik.pantu...@trustica.cz>:

> Hello,
>
> > If you are after numerical calculations for mxn matrices, then look at
> > `flomat`
> > which uses the same underlying C/Fortran library that NumPy uses.
> >
> > https://docs.racket-lang.org/manual-flomat/index.html
> >
> > If you need rrays with more dimensions than 2 use `math/array`.
> >
> > If you need simple computation of 1-dimensional data, you can use
> > standard Racket vectors (or flomats or arrays).
>
> I didn't know about `flomat'. Thanks for (yet another) good hint.
>
> However, for my project I needed really fast matrix multiplication (and
> other basic linear algebra functions). It turned out that most of the
> available options are sub-optimal at best. To my surprise `flomat` is
> one of those.
>
> Mostly I am concerned with 3D and 4D matrices and vectors.
>
> During the past few months I hacked together a fairly optimized
> module[1] for performing these operations that defines algebras for
> given dimension during macro expansion stage and all the procedures are
> constructed in a way that helps Racket (mainly CS) perform all
> operations unboxed.
>
> In the repository, there is a benchmark script, which yields the
> following (self-explanatory) results:
>
>  Welcome to Racket v7.9.0.5 [cs].
>
...

> What puzzles me the most: when I read `flomat' documentation, I thought
> it must beat my implementation by far margin - it's a native code for
> really basic number crunching. When using the `times!' variant of matrix
> multiplication, I would expect it to outperform anything implemented in
> in pure Racket.
>
> Is there something I miss or is it really the case, that carefully
> crafted Racket implementation is the fastest option right now?
>

I think the main reason that flomat matrices are slower than your flalgebra
ones
is the cost of the FFI call. The cost of calling a C foreign function
doesn't
depend on the size of the matrix though - so for large matrices the cost
is negligible. However for small matrices, it is faster to stay in the
Racket world.

I believe game libraries in C also implement their own 3x3 matrices rather
than using BLAS/LAPACK. BLAS can handle very large matrices and
makes an effort to give good results even for ill-conditioned matrices.


> I actually wanted to write a similar email some time ago - in the spring
> - about the typed math/matrix variant. But I was almost certain I am
> doing something wrong and should figure it out. Now I am more and more
> convinced that the performance of all number crunching libraries - as
> they can be used in Racket - might be the real issue here.
>

I have somewhat regretted that the matrices in math/matrix used math/array
arrays to represent matrices directly. A traditional approach would have
been
better. However math/matrix matrices are more general - they also work
when you need matrices over exact integers or over rationals.

In order from slowest to fastest (when used for floats over 3x3 matrices):

   math/matrix   (most general, very slow)
   flomat(only floats, arbitrary size)
   flagebra (floats, square only?)

To satisfy my curiosity, of the performance of flomat:

One way to get a little extra performance out of  flomat! is to use times!
instead of times. This avoids the repeated allocation. The code of times!
is:
[image: image.png]

For a more direct call to the C multiplication routine:

[image: image.png]
So `(flomat! A B C)` will compute A*B and store it in C.

Maybe there is a specialized A*B only routine in BLAS that
can be used instead?


The benchmarks suggest that the  `times` in flomat can be improved for
smaller matrices by calling specialized routines written in Racket.

If you (or anyone else) are interested in improving `flomat` for multiplying
smaller matrices, I would be glad to receive patches.

Btw - you have some fancy tricks in `flalgebra.rkt` !

/Jens Axel

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgxaLO%2Bz%2BHm04iMFu5nrTPFH8KkusCGoSNyHH%3D_bdT3L9A%40mail.gmail.com.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Nathaniel W Griswold
I checked into it a bit.

racket/fixnum, racket/flonum, and racket/vector are needed by 
“private/th-place.rkt”, which is required by racket/place. Not sure why 
DrRacket is saying that it’s not needed.

racket/runtime-path does not appear to be needed.

I tried removing racket/runtime-path and racket/match but didn’t see any 
performance gains. It appears the delay is elsewhere.

Nate

> On Nov 24, 2020, at 9:52 AM, Robby Findler  wrote:
> 
> DrRacket thinks that there are no references to a number of the requires in 
> racket/place, including racket/fixnum, racket/flonum, racket/vector, and 
> racket/runtime-path. Not sure if that's an error on DrRacket's part (and I 
> don't see why those would be needed for their effects).
> 
> Also, the only use of racket/match seems to be this, which seems simple to 
> rewrite out.
> 
> (match name
>   [(? symbol?) `(submod (quote ,name) ,submod-name)]
>   [(? path?) `(submod ,name ,submod-name)]
>   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s 
> ,submod-name)])
> 
> Robby
> 
> 
> On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold  > wrote:
> Oh, interesting. So compilation breaks the submodule out from the modules if 
> possible?
> 
> So anyway, it sounds like breaking my modules out into separate files will 
> improve performance in most cases.
> 
> Unfortunately, i need racket/place in the module that is my startup 
> bottleneck. If i modify the previous program to require racket/place and 
> compile, it takes around 180ms.
> 
> This is about what i can expect for a module that requires racket/place, then?
> 
> Nate
> 
> 
> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt  > wrote:
> Just to elaborate a little more:
> 
> The difference is because the `test` submodule can be loaded
> independently from the compiled form. Loading the submodule from source
> requires loading the enclosing module, too (which depends on
> `racket/place` and more).
> 
> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
> > Awesome, thanks!
> > 
> > Nate
> > 
> > 
> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt  > >
> > wrote:
> > 
> > > Almost certainly the problem is expansion time. If I run that program
> > > on my machine, it takes about 200 ms. But if I compile the file to zo
> > > first with `raco make`, then it takes about 40 ms, basically identical
> > > to `racket/base`.
> > >
> > > Sam
> > >
> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold  > > >
> > > wrote:
> > > >
> > > > Oops, i am having some issues with not getting to the list from my other
> > > email address. Here is a reply i sent for the record.
> > > >
> > > > ---
> > > >
> > > > Thank you, Matthew.
> > > >
> > > > The following code takes around 250ms on my machine. Any idea why? I was
> > > expecting it to be fast since the module is based on racket/base.
> > > >
> > > > #lang racket/base
> > > >
> > > > (require syntax/location)
> > > > (require racket/place)
> > > >
> > > >
> > > >
> > > > (module test racket/base
> > > >  (provide place-main)
> > > > racket
> > > >  (define (place-main pch)
> > > >   (void)))
> > > >
> > > > (time (place-wait (dynamic-place (quote-module-path test) 'place-main)))
> > > >
> > > > Nate
> > > >
> > > >
> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
> > >  wrote:
> > > >>
> > > >> Thank you, Matthew.
> > > >>
> > > >> The following code takes around 250ms on my machine. Any idea why? I
> > > was expecting it to be fast since the module is based on racket/base.
> > > >>
> > > >> #lang racket/base
> > > >>
> > > >> (require syntax/location)
> > > >> (require racket/place)
> > > >>
> > > >>
> > > >>
> > > >> (module test racket/base
> > > >>  (provide place-main)
> > > >> racket
> > > >>  (define (place-main pch)
> > > >>   (void)))
> > > >>
> > > >> (time (place-wait (dynamic-place (quote-module-path test) 
> > > >> 'place-main)))
> > > >>
> > > >> Nate
> > > >>
> > > >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt  > > >> > wrote:
> > > >>
> > > >> The bottleneck for place startup is loading modules into the new place,
> > > >> including modules like `racket/base`.
> > > >>
> > > >> For example,
> > > >>
> > > >>  (place-wait (dynamic-place 'racket 'void))
> > > >>
> > > >> takes around 200ms on my machine, while
> > > >>
> > > >>  (place-wait (dynamic-place 'racket/base 'void))
> > > >>
> > > >> takes around 30ms and
> > > >>
> > > >>  (place-wait (dynamic-place 'racket/kernel 'void))
> > > >>
> > > >> takes around 10ms.
> > > >>
> > > >> It sounds like you're already aware that the complexity of the module
> > > >> loaded into a place matters, though. Beyond using a minimal set of
> > > >> modules, I don't have any way to make place startup faster.
> > > >>
> > > >> Matthew
> > > >>
> > > >> At Tue, 24 Nov 2020 05:04:19 -0600, Nate Griswold wrote:
> > > >>
> > > >> Is there any way to ma

Re: [racket-users] snappier place startup time

2020-11-24 Thread Nathaniel W Griswold
Actually, it cuts about 20-25ms off of a single import. Down from 185ms to 
165ms for me. 50ms off my startup time of my app on average, since i basically 
stack the import twice and sync on the place being ready.

Might be worth including and seeing if there’s anything else that can be shaved 
off.

Nate

> On Nov 24, 2020, at 12:09 PM, Nathaniel W Griswold  
> wrote:
> 
> I checked into it a bit.
> 
> racket/fixnum, racket/flonum, and racket/vector are needed by 
> “private/th-place.rkt”, which is required by racket/place. Not sure why 
> DrRacket is saying that it’s not needed.
> 
> racket/runtime-path does not appear to be needed.
> 
> I tried removing racket/runtime-path and racket/match but didn’t see any 
> performance gains. It appears the delay is elsewhere.
> 
> Nate
> 
>> On Nov 24, 2020, at 9:52 AM, Robby Findler > > wrote:
>> 
>> DrRacket thinks that there are no references to a number of the requires in 
>> racket/place, including racket/fixnum, racket/flonum, racket/vector, and 
>> racket/runtime-path. Not sure if that's an error on DrRacket's part (and I 
>> don't see why those would be needed for their effects).
>> 
>> Also, the only use of racket/match seems to be this, which seems simple to 
>> rewrite out.
>> 
>> (match name
>>   [(? symbol?) `(submod (quote ,name) ,submod-name)]
>>   [(? path?) `(submod ,name ,submod-name)]
>>   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s 
>> ,submod-name)])
>> 
>> Robby
>> 
>> 
>> On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold > > wrote:
>> Oh, interesting. So compilation breaks the submodule out from the modules if 
>> possible?
>> 
>> So anyway, it sounds like breaking my modules out into separate files will 
>> improve performance in most cases.
>> 
>> Unfortunately, i need racket/place in the module that is my startup 
>> bottleneck. If i modify the previous program to require racket/place and 
>> compile, it takes around 180ms.
>> 
>> This is about what i can expect for a module that requires racket/place, 
>> then?
>> 
>> Nate
>> 
>> 
>> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt > > wrote:
>> Just to elaborate a little more:
>> 
>> The difference is because the `test` submodule can be loaded
>> independently from the compiled form. Loading the submodule from source
>> requires loading the enclosing module, too (which depends on
>> `racket/place` and more).
>> 
>> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
>> > Awesome, thanks!
>> > 
>> > Nate
>> > 
>> > 
>> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt > > >
>> > wrote:
>> > 
>> > > Almost certainly the problem is expansion time. If I run that program
>> > > on my machine, it takes about 200 ms. But if I compile the file to zo
>> > > first with `raco make`, then it takes about 40 ms, basically identical
>> > > to `racket/base`.
>> > >
>> > > Sam
>> > >
>> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold > > > >
>> > > wrote:
>> > > >
>> > > > Oops, i am having some issues with not getting to the list from my 
>> > > > other
>> > > email address. Here is a reply i sent for the record.
>> > > >
>> > > > ---
>> > > >
>> > > > Thank you, Matthew.
>> > > >
>> > > > The following code takes around 250ms on my machine. Any idea why? I 
>> > > > was
>> > > expecting it to be fast since the module is based on racket/base.
>> > > >
>> > > > #lang racket/base
>> > > >
>> > > > (require syntax/location)
>> > > > (require racket/place)
>> > > >
>> > > >
>> > > >
>> > > > (module test racket/base
>> > > >  (provide place-main)
>> > > > racket
>> > > >  (define (place-main pch)
>> > > >   (void)))
>> > > >
>> > > > (time (place-wait (dynamic-place (quote-module-path test) 
>> > > > 'place-main)))
>> > > >
>> > > > Nate
>> > > >
>> > > >
>> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
>> > > mailto:nate@manicmind.earth>> wrote:
>> > > >>
>> > > >> Thank you, Matthew.
>> > > >>
>> > > >> The following code takes around 250ms on my machine. Any idea why? I
>> > > was expecting it to be fast since the module is based on racket/base.
>> > > >>
>> > > >> #lang racket/base
>> > > >>
>> > > >> (require syntax/location)
>> > > >> (require racket/place)
>> > > >>
>> > > >>
>> > > >>
>> > > >> (module test racket/base
>> > > >>  (provide place-main)
>> > > >> racket
>> > > >>  (define (place-main pch)
>> > > >>   (void)))
>> > > >>
>> > > >> (time (place-wait (dynamic-place (quote-module-path test) 
>> > > >> 'place-main)))
>> > > >>
>> > > >> Nate
>> > > >>
>> > > >> On Nov 24, 2020, at 8:16 AM, Matthew Flatt > > > >> > wrote:
>> > > >>
>> > > >> The bottleneck for place startup is loading modules into the new 
>> > > >> place,
>> > > >> including modules like `racket/base`.
>> > > >>
>> > > >> For example,
>> > > >>
>> > > >>  (place-wait (dynamic-place 'racket 'void))
>> >

Re: [racket-users] snappier place startup time

2020-11-24 Thread Nathaniel W Griswold
I seem to remember there being some global namespace. Since every reasonable 
place will require racket/place, might it be possible to make the racket/place 
import a special case and stick it in the global space, to improve place setup 
time? It would be nice to be able to only set up racket/place one time instead 
of once for each place.

Nate

> On Nov 24, 2020, at 12:24 PM, Nathaniel W Griswold  
> wrote:
> 
> Actually, it cuts about 20-25ms off of a single import. Down from 185ms to 
> 165ms for me. 50ms off my startup time of my app on average, since i 
> basically stack the import twice and sync on the place being ready.
> 
> Might be worth including and seeing if there’s anything else that can be 
> shaved off.
> 
> Nate
> 
>> On Nov 24, 2020, at 12:09 PM, Nathaniel W Griswold > > wrote:
>> 
>> I checked into it a bit.
>> 
>> racket/fixnum, racket/flonum, and racket/vector are needed by 
>> “private/th-place.rkt”, which is required by racket/place. Not sure why 
>> DrRacket is saying that it’s not needed.
>> 
>> racket/runtime-path does not appear to be needed.
>> 
>> I tried removing racket/runtime-path and racket/match but didn’t see any 
>> performance gains. It appears the delay is elsewhere.
>> 
>> Nate
>> 
>>> On Nov 24, 2020, at 9:52 AM, Robby Findler >> > wrote:
>>> 
>>> DrRacket thinks that there are no references to a number of the requires in 
>>> racket/place, including racket/fixnum, racket/flonum, racket/vector, and 
>>> racket/runtime-path. Not sure if that's an error on DrRacket's part (and I 
>>> don't see why those would be needed for their effects).
>>> 
>>> Also, the only use of racket/match seems to be this, which seems simple to 
>>> rewrite out.
>>> 
>>> (match name
>>>   [(? symbol?) `(submod (quote ,name) ,submod-name)]
>>>   [(? path?) `(submod ,name ,submod-name)]
>>>   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s 
>>> ,submod-name)])
>>> 
>>> Robby
>>> 
>>> 
>>> On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold >> > wrote:
>>> Oh, interesting. So compilation breaks the submodule out from the modules 
>>> if possible?
>>> 
>>> So anyway, it sounds like breaking my modules out into separate files will 
>>> improve performance in most cases.
>>> 
>>> Unfortunately, i need racket/place in the module that is my startup 
>>> bottleneck. If i modify the previous program to require racket/place and 
>>> compile, it takes around 180ms.
>>> 
>>> This is about what i can expect for a module that requires racket/place, 
>>> then?
>>> 
>>> Nate
>>> 
>>> 
>>> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt >> > wrote:
>>> Just to elaborate a little more:
>>> 
>>> The difference is because the `test` submodule can be loaded
>>> independently from the compiled form. Loading the submodule from source
>>> requires loading the enclosing module, too (which depends on
>>> `racket/place` and more).
>>> 
>>> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
>>> > Awesome, thanks!
>>> > 
>>> > Nate
>>> > 
>>> > 
>>> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt >> > >
>>> > wrote:
>>> > 
>>> > > Almost certainly the problem is expansion time. If I run that program
>>> > > on my machine, it takes about 200 ms. But if I compile the file to zo
>>> > > first with `raco make`, then it takes about 40 ms, basically identical
>>> > > to `racket/base`.
>>> > >
>>> > > Sam
>>> > >
>>> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold >> > > >
>>> > > wrote:
>>> > > >
>>> > > > Oops, i am having some issues with not getting to the list from my 
>>> > > > other
>>> > > email address. Here is a reply i sent for the record.
>>> > > >
>>> > > > ---
>>> > > >
>>> > > > Thank you, Matthew.
>>> > > >
>>> > > > The following code takes around 250ms on my machine. Any idea why? I 
>>> > > > was
>>> > > expecting it to be fast since the module is based on racket/base.
>>> > > >
>>> > > > #lang racket/base
>>> > > >
>>> > > > (require syntax/location)
>>> > > > (require racket/place)
>>> > > >
>>> > > >
>>> > > >
>>> > > > (module test racket/base
>>> > > >  (provide place-main)
>>> > > > racket
>>> > > >  (define (place-main pch)
>>> > > >   (void)))
>>> > > >
>>> > > > (time (place-wait (dynamic-place (quote-module-path test) 
>>> > > > 'place-main)))
>>> > > >
>>> > > > Nate
>>> > > >
>>> > > >
>>> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
>>> > > mailto:nate@manicmind.earth>> wrote:
>>> > > >>
>>> > > >> Thank you, Matthew.
>>> > > >>
>>> > > >> The following code takes around 250ms on my machine. Any idea why? I
>>> > > was expecting it to be fast since the module is based on racket/base.
>>> > > >>
>>> > > >> #lang racket/base
>>> > > >>
>>> > > >> (require syntax/location)
>>> > > >> (require racket/place)
>>> > > >>
>>> > > >>
>>> > > >>
>>> > > >> (module test racket/base
>>

Re: [racket-users] snappier place startup time

2020-11-24 Thread Nathaniel W Griswold
I noticed i am using the pl- functions so I replaced th-place.rkt with a stub 
and saw more time shaved off, this time about 15ms for each racket/place import.

Under what circumstances is th-place used instead of '#%place and needed?

Nate

> On Nov 24, 2020, at 12:31 PM, Nathaniel W Griswold  
> wrote:
> 
> I seem to remember there being some global namespace. Since every reasonable 
> place will require racket/place, might it be possible to make the 
> racket/place import a special case and stick it in the global space, to 
> improve place setup time? It would be nice to be able to only set up 
> racket/place one time instead of once for each place.
> 
> Nate
> 
>> On Nov 24, 2020, at 12:24 PM, Nathaniel W Griswold > > wrote:
>> 
>> Actually, it cuts about 20-25ms off of a single import. Down from 185ms to 
>> 165ms for me. 50ms off my startup time of my app on average, since i 
>> basically stack the import twice and sync on the place being ready.
>> 
>> Might be worth including and seeing if there’s anything else that can be 
>> shaved off.
>> 
>> Nate
>> 
>>> On Nov 24, 2020, at 12:09 PM, Nathaniel W Griswold >> > wrote:
>>> 
>>> I checked into it a bit.
>>> 
>>> racket/fixnum, racket/flonum, and racket/vector are needed by 
>>> “private/th-place.rkt”, which is required by racket/place. Not sure why 
>>> DrRacket is saying that it’s not needed.
>>> 
>>> racket/runtime-path does not appear to be needed.
>>> 
>>> I tried removing racket/runtime-path and racket/match but didn’t see any 
>>> performance gains. It appears the delay is elsewhere.
>>> 
>>> Nate
>>> 
 On Nov 24, 2020, at 9:52 AM, Robby Findler >>> > wrote:
 
 DrRacket thinks that there are no references to a number of the requires 
 in racket/place, including racket/fixnum, racket/flonum, racket/vector, 
 and racket/runtime-path. Not sure if that's an error on DrRacket's part 
 (and I don't see why those would be needed for their effects).
 
 Also, the only use of racket/match seems to be this, which seems simple to 
 rewrite out.
 
 (match name
   [(? symbol?) `(submod (quote ,name) ,submod-name)]
   [(? path?) `(submod ,name ,submod-name)]
   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s 
 ,submod-name)])
 
 Robby
 
 
 On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold >>> > wrote:
 Oh, interesting. So compilation breaks the submodule out from the modules 
 if possible?
 
 So anyway, it sounds like breaking my modules out into separate files will 
 improve performance in most cases.
 
 Unfortunately, i need racket/place in the module that is my startup 
 bottleneck. If i modify the previous program to require racket/place and 
 compile, it takes around 180ms.
 
 This is about what i can expect for a module that requires racket/place, 
 then?
 
 Nate
 
 
 On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt >>> > wrote:
 Just to elaborate a little more:
 
 The difference is because the `test` submodule can be loaded
 independently from the compiled form. Loading the submodule from source
 requires loading the enclosing module, too (which depends on
 `racket/place` and more).
 
 At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
 > Awesome, thanks!
 > 
 > Nate
 > 
 > 
 > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt 
 > mailto:sa...@cs.indiana.edu>>
 > wrote:
 > 
 > > Almost certainly the problem is expansion time. If I run that program
 > > on my machine, it takes about 200 ms. But if I compile the file to zo
 > > first with `raco make`, then it takes about 40 ms, basically identical
 > > to `racket/base`.
 > >
 > > Sam
 > >
 > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold >>> > > >
 > > wrote:
 > > >
 > > > Oops, i am having some issues with not getting to the list from my 
 > > > other
 > > email address. Here is a reply i sent for the record.
 > > >
 > > > ---
 > > >
 > > > Thank you, Matthew.
 > > >
 > > > The following code takes around 250ms on my machine. Any idea why? I 
 > > > was
 > > expecting it to be fast since the module is based on racket/base.
 > > >
 > > > #lang racket/base
 > > >
 > > > (require syntax/location)
 > > > (require racket/place)
 > > >
 > > >
 > > >
 > > > (module test racket/base
 > > >  (provide place-main)
 > > > racket
 > > >  (define (place-main pch)
 > > >   (void)))
 > > >
 > > > (time (place-wait (dynamic-place (quote-module-path test) 
 > > > 'place-main)))
 > > >
 > > > Nate
 > > >
 > > >
 > > > On Tue, Nov 24, 2020

Re: [racket-users] snappier place startup time

2020-11-24 Thread Sam Tobin-Hochstadt
th-place is used if places are not enabled when Racket is built (this is
the default on some platforms).

I'm making progress on shrinking this, hopefully I'll have a patch done
soon.

One thing to note is that '#%place can be required directly and will have
almost no start-up cost.

Sam

Sam

On Tue, Nov 24, 2020, 1:58 PM Nathaniel W Griswold 
wrote:

> I noticed i am using the pl- functions so I replaced th-place.rkt with a
> stub and saw more time shaved off, this time about 15ms for each
> racket/place import.
>
> Under what circumstances is th-place used instead of '#%place and needed?
>
> Nate
>
> On Nov 24, 2020, at 12:31 PM, Nathaniel W Griswold 
> wrote:
>
> I seem to remember there being some global namespace. Since every
> reasonable place will require racket/place, might it be possible to make
> the racket/place import a special case and stick it in the global space, to
> improve place setup time? It would be nice to be able to only set up
> racket/place one time instead of once for each place.
>
> Nate
>
> On Nov 24, 2020, at 12:24 PM, Nathaniel W Griswold 
> wrote:
>
> Actually, it cuts about 20-25ms off of a single import. Down from 185ms to
> 165ms for me. 50ms off my startup time of my app on average, since i
> basically stack the import twice and sync on the place being ready.
>
> Might be worth including and seeing if there’s anything else that can be
> shaved off.
>
> Nate
>
> On Nov 24, 2020, at 12:09 PM, Nathaniel W Griswold 
> wrote:
>
> I checked into it a bit.
>
> racket/fixnum, racket/flonum, and racket/vector are needed by
> “private/th-place.rkt”, which is required by racket/place. Not sure why
> DrRacket is saying that it’s not needed.
>
> racket/runtime-path does not appear to be needed.
>
> I tried removing racket/runtime-path and racket/match but didn’t see any
> performance gains. It appears the delay is elsewhere.
>
> Nate
>
> On Nov 24, 2020, at 9:52 AM, Robby Findler 
> wrote:
>
> DrRacket thinks that there are no references to a number of the requires
> in racket/place, including racket/fixnum, racket/flonum, racket/vector, and
> racket/runtime-path. Not sure if that's an error on DrRacket's part (and I
> don't see why those would be needed for their effects).
>
> Also, the only use of racket/match seems to be this, which seems simple to
> rewrite out.
>
> (match name
>   [(? symbol?) `(submod (quote ,name) ,submod-name)]
>   [(? path?) `(submod ,name ,submod-name)]
>   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s
> ,submod-name)])
>
> Robby
>
>
> On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold 
> wrote:
>
>> Oh, interesting. So compilation breaks the submodule out from the modules
>> if possible?
>>
>> So anyway, it sounds like breaking my modules out into separate files
>> will improve performance in most cases.
>>
>> Unfortunately, i need racket/place in the module that is my startup
>> bottleneck. If i modify the previous program to require racket/place and
>> compile, it takes around 180ms.
>>
>> This is about what i can expect for a module that requires racket/place,
>> then?
>>
>> Nate
>>
>>
>> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt  wrote:
>>
>>> Just to elaborate a little more:
>>>
>>> The difference is because the `test` submodule can be loaded
>>> independently from the compiled form. Loading the submodule from source
>>> requires loading the enclosing module, too (which depends on
>>> `racket/place` and more).
>>>
>>> At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
>>> > Awesome, thanks!
>>> >
>>> > Nate
>>> >
>>> >
>>> > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt <
>>> sa...@cs.indiana.edu>
>>> > wrote:
>>> >
>>> > > Almost certainly the problem is expansion time. If I run that program
>>> > > on my machine, it takes about 200 ms. But if I compile the file to zo
>>> > > first with `raco make`, then it takes about 40 ms, basically
>>> identical
>>> > > to `racket/base`.
>>> > >
>>> > > Sam
>>> > >
>>> > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold <
>>> nategrisw...@gmail.com>
>>> > > wrote:
>>> > > >
>>> > > > Oops, i am having some issues with not getting to the list from my
>>> other
>>> > > email address. Here is a reply i sent for the record.
>>> > > >
>>> > > > ---
>>> > > >
>>> > > > Thank you, Matthew.
>>> > > >
>>> > > > The following code takes around 250ms on my machine. Any idea why?
>>> I was
>>> > > expecting it to be fast since the module is based on racket/base.
>>> > > >
>>> > > > #lang racket/base
>>> > > >
>>> > > > (require syntax/location)
>>> > > > (require racket/place)
>>> > > >
>>> > > >
>>> > > >
>>> > > > (module test racket/base
>>> > > >  (provide place-main)
>>> > > > racket
>>> > > >  (define (place-main pch)
>>> > > >   (void)))
>>> > > >
>>> > > > (time (place-wait (dynamic-place (quote-module-path test)
>>> 'place-main)))
>>> > > >
>>> > > > Nate
>>> > > >
>>> > > >
>>> > > > On Tue, Nov 24, 2020 at 8:35 AM Nathaniel W Griswold
>>> > >  wrote:
>>> > > >>
>>> > > >> Than

Re: [SPAM] Re: [racket-users] snappier place startup time

2020-11-24 Thread Robby Findler
On Tue, Nov 24, 2020 at 12:09 PM Nathaniel W Griswold 
wrote:

> racket/fixnum, racket/flonum, and racket/vector are needed by
> “private/th-place.rkt”, which is required by racket/place. Not sure why
> DrRacket is saying that it’s not needed.
>
>
Ah, sorry: DrRacket was merely saying that the exports of those modules
weren't used by the racket/place module.

Robby

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOOkdBjyxjUOnUE6_CmsuioHfCx7OJn5Bh6dqS4uQm78yA%40mail.gmail.com.


Re: [racket-users] snappier place startup time

2020-11-24 Thread Sam Tobin-Hochstadt
Here's an in-progress PR: https://github.com/racket/racket/pull/3518

With this, your simple test takes about 150ms with `racket/place` and
50ms with `racket/place/dynamic`. For comparison, just having the
submodule depend on `racket/base` gives a time of about 42 ms, and
just `racket/kernel` is about 12ms.

Sam

On Tue, Nov 24, 2020 at 2:04 PM Sam Tobin-Hochstadt
 wrote:
>
> th-place is used if places are not enabled when Racket is built (this is the 
> default on some platforms).
>
> I'm making progress on shrinking this, hopefully I'll have a patch done soon.
>
> One thing to note is that '#%place can be required directly and will have 
> almost no start-up cost.
>
> Sam
>
> Sam
>
> On Tue, Nov 24, 2020, 1:58 PM Nathaniel W Griswold  
> wrote:
>>
>> I noticed i am using the pl- functions so I replaced th-place.rkt with a 
>> stub and saw more time shaved off, this time about 15ms for each 
>> racket/place import.
>>
>> Under what circumstances is th-place used instead of '#%place and needed?
>>
>> Nate
>>
>> On Nov 24, 2020, at 12:31 PM, Nathaniel W Griswold  
>> wrote:
>>
>> I seem to remember there being some global namespace. Since every reasonable 
>> place will require racket/place, might it be possible to make the 
>> racket/place import a special case and stick it in the global space, to 
>> improve place setup time? It would be nice to be able to only set up 
>> racket/place one time instead of once for each place.
>>
>> Nate
>>
>> On Nov 24, 2020, at 12:24 PM, Nathaniel W Griswold  
>> wrote:
>>
>> Actually, it cuts about 20-25ms off of a single import. Down from 185ms to 
>> 165ms for me. 50ms off my startup time of my app on average, since i 
>> basically stack the import twice and sync on the place being ready.
>>
>> Might be worth including and seeing if there’s anything else that can be 
>> shaved off.
>>
>> Nate
>>
>> On Nov 24, 2020, at 12:09 PM, Nathaniel W Griswold  
>> wrote:
>>
>> I checked into it a bit.
>>
>> racket/fixnum, racket/flonum, and racket/vector are needed by 
>> “private/th-place.rkt”, which is required by racket/place. Not sure why 
>> DrRacket is saying that it’s not needed.
>>
>> racket/runtime-path does not appear to be needed.
>>
>> I tried removing racket/runtime-path and racket/match but didn’t see any 
>> performance gains. It appears the delay is elsewhere.
>>
>> Nate
>>
>> On Nov 24, 2020, at 9:52 AM, Robby Findler  wrote:
>>
>> DrRacket thinks that there are no references to a number of the requires in 
>> racket/place, including racket/fixnum, racket/flonum, racket/vector, and 
>> racket/runtime-path. Not sure if that's an error on DrRacket's part (and I 
>> don't see why those would be needed for their effects).
>>
>> Also, the only use of racket/match seems to be this, which seems simple to 
>> rewrite out.
>>
>> (match name
>>   [(? symbol?) `(submod (quote ,name) ,submod-name)]
>>   [(? path?) `(submod ,name ,submod-name)]
>>   [`(,p ,s ...) `(submod ,(if (symbol? p) `(quote ,p) p) ,@s 
>> ,submod-name)])
>>
>> Robby
>>
>>
>> On Tue, Nov 24, 2020 at 8:58 AM Nate Griswold  wrote:
>>>
>>> Oh, interesting. So compilation breaks the submodule out from the modules 
>>> if possible?
>>>
>>> So anyway, it sounds like breaking my modules out into separate files will 
>>> improve performance in most cases.
>>>
>>> Unfortunately, i need racket/place in the module that is my startup 
>>> bottleneck. If i modify the previous program to require racket/place and 
>>> compile, it takes around 180ms.
>>>
>>> This is about what i can expect for a module that requires racket/place, 
>>> then?
>>>
>>> Nate
>>>
>>>
>>> On Tue, Nov 24, 2020 at 8:48 AM Matthew Flatt  wrote:

 Just to elaborate a little more:

 The difference is because the `test` submodule can be loaded
 independently from the compiled form. Loading the submodule from source
 requires loading the enclosing module, too (which depends on
 `racket/place` and more).

 At Tue, 24 Nov 2020 08:46:12 -0600, Nate Griswold wrote:
 > Awesome, thanks!
 >
 > Nate
 >
 >
 > On Tue, Nov 24, 2020 at 8:44 AM Sam Tobin-Hochstadt 
 > 
 > wrote:
 >
 > > Almost certainly the problem is expansion time. If I run that program
 > > on my machine, it takes about 200 ms. But if I compile the file to zo
 > > first with `raco make`, then it takes about 40 ms, basically identical
 > > to `racket/base`.
 > >
 > > Sam
 > >
 > > On Tue, Nov 24, 2020 at 9:39 AM Nate Griswold 
 > > wrote:
 > > >
 > > > Oops, i am having some issues with not getting to the list from my 
 > > > other
 > > email address. Here is a reply i sent for the record.
 > > >
 > > > ---
 > > >
 > > > Thank you, Matthew.
 > > >
 > > > The following code takes around 250ms on my machine. Any idea why? I 
 > > > was
 > > expecting it to be fast since the module is based on racket/base.
 > > >
 > > > 

Re: [racket-users] Linear algebra performance (was: calculations with arrays)

2020-11-24 Thread Bertrand Augereau
>
> I believe game libraries in C also implement their own 3x3 matrices rather
> than using BLAS/LAPACK. BLAS can handle very large matrices and
> makes an effort to give good results even for ill-conditioned matrices.
>

They sure do. Generally as 4x4 or implicit homogeneous 4x3 matrices to help
leverage a little SIMD.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAHV%3D05q4ZZ3WD61hT1C8fSxoYXAq9ahShCUDP85MUYaEE5j5Og%40mail.gmail.com.


[racket-users] Download the tsuro implementation from the paper

2020-11-24 Thread Nate Griswold
Hello. I've looked through the paper a couple of times and I don't see a
link to download the tsuro prototype. Is this code available somewhere?

Nate

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPo9OnnQKK%3D0yOZPbTuLyZjHMJp6i9TViLYgA2XtWrGejg%40mail.gmail.com.


[racket-users] executables

2020-11-24 Thread Tim Meehan
Some Schemes allow you to compile to a (self-hosting?) executable (Chicken
{via C}, Chez, Racket, others?). Some do not (Guile, others?), but compile
to bytecode.

Why would a group of developers choose one over the other? Or is the end
result not that different in either case? Is there a book/paper that I
might read on this?

Cheers,
Tim

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CACgrOxL%2BkyKmcv7Z8Foc2Jqkp69SY7mRnUKUSFpzPf4EaHBj_w%40mail.gmail.com.


Re: [racket-users] executables

2020-11-24 Thread George Neuner


On 11/24/2020 7:34 PM, Tim Meehan wrote:
Some Schemes allow you to compile to a (self-hosting?) executable 
(Chicken {via C}, Chez, Racket, others?). Some do not (Guile, 
others?), but compile to bytecode.


Why would a group of developers choose one over the other? Or is the 
end result not that different in either case?


The reason for creating stand-alone executables is to be able to run 
programs in environments where the language tools are not, or cannot be, 
installed.  For security reasons, many companies do not permit 
installing programming tools.


However, creating stand-alone executables is rather unrelated to what 
the compiler produces.  There are a number of language implementations - 
Racket included - which can embed their bytecode (as static data) into a 
native "runtime" program which executes it.



Is there a book/paper that I might read on this?


Unfortunately, language implementation is a very large subject area.  If 
you want to understand why things are being done a certain way, you need 
to understand the ways that they *could be* done and what trade-offs are 
involved in using various methods.


Little understood fact:  all languages actually are defined by a 
*virtual* abstract machine.  This is the reason that languages can be 
implemented on many different real-world CPUs:  it is the abstract 
machine that defines the language's behavior, and it is the abstract 
machine - not some CPU - that is the *real* compilation target.
[For those about to object: yes, Scheme has a formal denotational 
definition in contrast to the many languages that are operationally 
defined by (relatively) informal description of behavior combined with a 
"reference" implementation.  Consider that Scheme's denotational spec is 
describing the behavior of an abstract machine, and that Scheme 
implementations are realizations of the machine.]


To get a sense of what is going on under the hood, you need to learn a 
bit about hardware, and a lot about compilers and interpreters. 
Particular language features often can be implemented in multiple ways, 
and the choices made for various features often affect how harmoniously 
they can coexist.


If you really are serious about learning this stuff, I'm sure we can 
keep you busy reading for a while.



Cheers,
Tim


George

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/8a2d8868-41b7-7b3c-eba2-2cf0517032a8%40comcast.net.