unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: "Dr. Arne Babenhauserheide" <arne_bab@web.de>,
	Damien Mattei <damien.mattei@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: speed difference between Guile and Racket (and Python)
Date: Mon,  7 Nov 2022 13:23:43 +0000	[thread overview]
Message-ID: <26ed694e-c26e-ecef-506d-5ca8cea988e1@posteo.de> (raw)
In-Reply-To: <871qqfqfjn.fsf@web.de>

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.mattei@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




  reply	other threads:[~2022-11-07 13:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06 16:01 speed difference between Guile and Racket (and Python) Damien Mattei
2022-11-06 22:23 ` Speed " Hans Åberg
2022-11-06 22:35   ` Damien Mattei
2022-11-07  9:21 ` speed " Dr. Arne Babenhauserheide
2022-11-07 13:23   ` Zelphir Kaltstahl [this message]
2022-11-09 14:24   ` Damien Mattei
2022-11-08  8:03 ` Linus Björnstam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26ed694e-c26e-ecef-506d-5ca8cea988e1@posteo.de \
    --to=zelphirkaltstahl@posteo.de \
    --cc=arne_bab@web.de \
    --cc=damien.mattei@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).