From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: speed difference between Guile and Racket (and Python) Date: Mon, 7 Nov 2022 13:23:43 +0000 Message-ID: <26ed694e-c26e-ecef-506d-5ca8cea988e1@posteo.de> References: <871qqfqfjn.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22435"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user@gnu.org To: "Dr. Arne Babenhauserheide" , Damien Mattei Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Nov 07 14:25:27 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1os27z-0005d1-1E for guile-user@m.gmane-mx.org; Mon, 07 Nov 2022 14:25:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1os26i-000736-Nv; Mon, 07 Nov 2022 08:24:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1os26R-0006xC-3R for guile-user@gnu.org; Mon, 07 Nov 2022 08:23:53 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1os26O-0005cA-AL for guile-user@gnu.org; Mon, 07 Nov 2022 08:23:50 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 18BEA24002A for ; Mon, 7 Nov 2022 14:23:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1667827425; bh=yVBRB+5aYaGiTbY77WhaID7rFsG8w/Hmc/gIyp49Dwk=; h=Date:Subject:To:Cc:From:From; b=djBNy9d4B6gUa7DddAVIb9bgSu6lqpvrIG3BNTDODUHvHiY3xCr5P7N+Nked1c30k RvqhZ5IdT+hqAfnWumleaqmliBIcOrjJsUgcKtvLTC5md254C5gOY3sLO7eLCAHSZ6 vHCYJ4WasTQCz0/CHi+okkFB7Pb5+LzADcaQ2l2ikHnsLgFIxUD7FDIZo+QzyoKJtg SnwVTv8fV3sAGLWHYMFhOKgFEelKnpKDk/08ElEIuhOso4svP+UnFeXZnI16lFl1n6 1zEbnx4uymSN4Ydp4VS4GjsadkKtpz9xzxuJDVe/GYE0BalHMJGpKEz5vfgksNlgGp r4qKPlZ7p+1zQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N5X4J0ZP7z9rxD; Mon, 7 Nov 2022 14:23:44 +0100 (CET) Content-Language: en-US In-Reply-To: <871qqfqfjn.fsf@web.de> Received-SPF: pass client-ip=185.67.36.65; envelope-from=zelphirkaltstahl@posteo.de; helo=mout01.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18697 Archived-At: 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 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