Hi!
I think the only way to use multiple cores in Racket is to use "places" and that
means starting new Racket VMs.
Lambdas are not easily serialized with all their environment, so it is difficult
to actually "send a lambda" to another "place" (Racket VM) dynamically. The only
way I found was to not send them at all, but predefine functions, so that they
are already known in other places and do not need to be send. Instead send only
data.
This makes it difficult to build a pool for things (threads, workers, etc.),
that run on multiple cores and dynamically accept "work" to do. (– Has anyone
done it? With dynamically calculated work being sent to the threads/workers?
I've not seen an example.) This was unsatisfactory for me for implementing a
decision tree algorithm, which is, why I originally took a look at Guile.
So I think as a consequence there is a lot of overhead when using multiple cores
in Racket. At least initially, for starting Racket VMs (places).
(Correct me, if I am wrong about these things. It is only my experience from
using Racket before using Guile, and I learned a lot since then.)
I would expect using futures on Guile to have much less overhead, than starting
Racket places and fibers to have even less overhead than futures. But this is
only guessing. From that I would expect multi-core with many separate tasks to
run, to be faster on Guile. But again, merely guessing around. If sequential
execution is faster in Racket, there is probably some point, at which
parallelizing outweighs the benefits of sequentially being faster.
Regards,
Zelphir
On 11/7/22 10:21, Dr. Arne Babenhauserheide wrote:
Damien Mattei <damien.mat...@gmail.com> writes:
when comparing the (almost) same code running on Guile and Racket i find
big speed difference:
Schemes differ a lot in speed of different tasks, but Racket is one of
the fastest ones. Factor 2 difference sounds plausible. For a
comparison, see the r7rs benchmarks:
https://ecraven.github.io/r7rs-benchmarks/
That said, I have seen 10x speedups in Guile code when people went for
optimizing it.
last version of code is here:
https://github.com/damien-mattei/library-FunctProg/blob/master/guile/logiki%2B.scm#L3092
Could you give the shell commands to setup and run your speed-test?
Best wishes,
Arne
--
repositories: https://notabug.org/ZelphirKaltstahl