From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: Guile's time execution issues Date: Mon, 04 May 2020 11:36:47 +0200 Message-ID: <87r1w0rqhc.fsf@gnu.org> References: <87d07u182a.fsf@gnu.org> <87a72q77gr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="6625"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: guile-user , guile-devel To: Aleix Conchillo =?utf-8?Q?Flaqu=C3=A9?= Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon May 04 11:37:13 2020 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 1jVXXF-0001de-Cn for guile-user@m.gmane-mx.org; Mon, 04 May 2020 11:37:13 +0200 Original-Received: from localhost ([::1]:39352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXXE-0003LC-8u for guile-user@m.gmane-mx.org; Mon, 04 May 2020 05:37:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVXWs-0003Ko-RI; Mon, 04 May 2020 05:36:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53489) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVXWs-0005kC-IB; Mon, 04 May 2020 05:36:50 -0400 Original-Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51616 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jVXWr-0006mH-0e; Mon, 04 May 2020 05:36:50 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 16 =?utf-8?Q?Flor=C3=A9al?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu In-Reply-To: ("Aleix Conchillo \=\?utf-8\?Q\?Flaqu\=C3\=A9\=22's\?\= message of "Sun, 3 May 2020 17:32:29 -0700") X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.lisp.guile.user:16423 gmane.lisp.guile.devel:20507 Archived-At: Hey! Aleix Conchillo Flaqu=C3=A9 skribis: > So weird I'm getting different numbers on 2.2.7. Not sure how I'm getting= those initial ~20s and you are getting consistent ~ 45s. It > shouldn't have nothing to do with it, but could it be I'm running it on m= acOS? Did you add this =E2=80=98->bool=E2=80=99 call to ensure the resulting alis= t is not kept in memory? > Now, it would be good to profile =E2=80=98json->scm=E2=80=99 to see if t= here=E2=80=99s anything > that could be improved on the Guile side, or if it=E2=80=99s just a norm= al > profile for GC-intensive code. > > Good news is that I have been working on performance improvements and jso= n->scm is going down from my ~19 seconds to ~3 > seconds on the same sample file. Linus Bj=C3=B6rnstam was the one to brin= g up performance issues so we've been back and forth trying to > make it fast. Nice! > One thing I found is that `match` is slow. The code looked nicer but had = to change it back to lets and conds as the performance > increase was ~2 seconds. Oh, in which case exactly? And are you sure your hand-written code is equivalent to the =E2=80=98match=E2=80=99 code (it=E2=80=99s common for han= d-written code to be more lax than =E2=80=98match=E2=80=99)? One thing to pay attention to is the use of =E2=80=98list?=E2=80=99, which = is O(N), and is implied by ellipses in =E2=80=98match=E2=80=99. If you want to use =E2= =80=98match=E2=80=99 in a way that avoids =E2=80=98list?=E2=80=99, write patterns such as (a . b) instead= of (a b ...). It doesn=E2=80=99t have the same meaning, but often the end result is the s= ame, for instance because you=E2=80=99ll later match on =E2=80=98b=E2=80=99 anyw= ay. (I wish we can one day have a proper list type disjoint from pairs=E2=80=A6) Thanks, Ludo=E2=80=99.