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?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: Guile's time execution issues Date: Mon, 04 May 2020 20:47:47 +0200 Message-ID: References: <87d07u182a.fsf@gnu.org> <87a72q77gr.fsf@gnu.org> <87r1w0rqhc.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="45242"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.3.0-dev0-351-g9981f4f-fmstable-20200421v1 Cc: guile-user , guile-devel To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= , =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon May 04 20:48:28 2020 Return-path: Envelope-to: guile-devel@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 1jVg8h-000Bf9-Dk for guile-devel@m.gmane-mx.org; Mon, 04 May 2020 20:48:27 +0200 Original-Received: from localhost ([::1]:38376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVg8g-0001tz-Eu for guile-devel@m.gmane-mx.org; Mon, 04 May 2020 14:48:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVg8R-0001s8-0g; Mon, 04 May 2020 14:48:11 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:39229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVg8P-0003xv-Rb; Mon, 04 May 2020 14:48:10 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 243A15C00CA; Mon, 4 May 2020 14:48:08 -0400 (EDT) Original-Received: from imap1 ([10.202.2.51]) by compute7.internal (MEProxy); Mon, 04 May 2020 14:48:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=veryfast.biz; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type:content-transfer-encoding; s=fm2; bh=2Lcr3 aRnjY5+agod6A9vstmGzCG5ypTA4aFXt6ndV6w=; b=lj/rZz4lQtPXpnkB3lEo1 krLBk9zV3fbZiKjzlp0fTwwz3qMGIyuJehHRTB1joEqhT7z7ssxSfYSjXiro0wM8 ltPlh1GDejFtBkpdVzWHDhucGs1jcmI2OTiPZ6GfbN2GHApdhijKqZy2e5yjFUtj 0j7k++KVZACI2+nDmwRkHXLULVx3wSMdmUxBc1gxYY5NT1EEGvYqrQ2++i/DeoXY AhH4QsQskT7Z6ZWA3FEF23IDS0OG/uFLCQ/WwI/ol/V3iIsPzeuO2TRYX49nneiy xvFhqdW1gDFLyiMh8ChrzFWli/lZz0hOAzVQ0DZO1ZRV3nHoMJvE3TvlH3UMXrM5 w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=2Lcr3aRnjY5+agod6A9vstmGzCG5ypTA4aFXt6ndV 6w=; b=FsozSMjlwqFCZ81uBF0uWKwjjAaeN8rUGugsdewL9jy9prRq/zAsl5NzS 8VabFdfWvdc6pNosIiGPXmM6yIFdeyLFCNaO8IFiOH+KI77FhA5ghkGSTO9cRmcL FpILvnOCCM9+i7TxPY1V3gNqpT1iGwwz6BkJdpFS6098I77Nd+ith9wXMUnv0Adq VBICRBJkjP1v9xSaU0UZW/WIyBqVo5lew+7MsWlIwaSQDEXfK/MZ9Mio6DtfGPEa PdN+tkrd+uSh96aiaeEoibD/8IIRsfOX1GiWdhf4CIYt+pS49Zd7brYzs6nR83Ew U1rjMdwnMMzjPuIRrRlnW6HRfFriw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrjeeggdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpefnihhn uhhspgeujhpnrhhnshhtrghmuceolhhinhhushdrsghjohhrnhhsthgrmhesvhgvrhihfh grshhtrdgsihiiqeenucggtffrrghtthgvrhhnpeetvdeuteehueektefhuddvjeelteff uedvvdeuudeiuedvtedtueehhedvjeeiffenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehlihhnuhhsrdgsjhhorhhnshhtrghmsehvvghrhihf rghsthdrsghiii X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id D1929C200A4; Mon, 4 May 2020 14:48:07 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <87r1w0rqhc.fsf@gnu.org> Received-SPF: pass client-ip=66.111.4.27; envelope-from=linus.bjornstam@veryfast.biz; helo=out3-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 12:27:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20509 gmane.lisp.guile.user:16425 Archived-At: Sorry, sent a premature reply. The problem is that some of those match b= locks expand to using equal? which is a lot slower than using eqv? If we= are doing it on every char in a 24mb file we are getting some serious c= onstant factors.=20 match is a syntax-rules macro, so distinguishing literals are not possib= le. Concerning "the macro writer's bill of rights" I could maybe think t= his it would be a rather nice thing to turn equal? to eqv? when one argu= ment is a char literal :D --=20 Linus Bj=C3=B6rnstam On Mon, 4 May 2020, at 11:36, Ludovic Court=C3=A8s wrote: > Hey! >=20 > Aleix Conchillo Flaqu=C3=A9 skribis: >=20 > > So weird I'm getting different numbers on 2.2.7. Not sure how I'm ge= tting 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 macOS? >=20 > Did you add this =E2=80=98->bool=E2=80=99 call to ensure the resulting= alist is not kept > in memory? >=20 > > Now, it would be good to profile =E2=80=98json->scm=E2=80=99 to see= if there=E2=80=99s anything > > that could be improved on the Guile side, or if it=E2=80=99s just a= normal > > profile for GC-intensive code. > > > > Good news is that I have been working on performance improvements an= d json->scm is going down from my ~19 seconds to ~3 > > seconds on the same sample file. Linus Bj=C3=B6rnstam was the one to= bring up performance issues so we've been back and forth trying to > > make it fast. >=20 > Nice! >=20 > > 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. >=20 > 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 fo= r hand-written code to be > more lax than =E2=80=98match=E2=80=99)? >=20 > One thing to pay attention to is the use of =E2=80=98list?=E2=80=99, w= hich 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) in= stead of (a b ...). > It doesn=E2=80=99t have the same meaning, but often the end result is = the same, > for instance because you=E2=80=99ll later match on =E2=80=98b=E2=80=99= anyway. >=20 > (I wish we can one day have a proper list type disjoint from pairs=E2=80= =A6) >=20 > Thanks, > Ludo=E2=80=99. >=20 >