From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Add tree-il optimizations for equal? on char and number literals Date: Wed, 13 May 2020 15:55:23 +0200 Message-ID: <8736849bxw.fsf@pobox.com> References: <71bf4755-11b0-4211-abe7-677adc14db76@www.fastmail.com> 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="86933"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: guile-devel@gnu.org To: Linus =?utf-8?Q?Bj=C3=B6rnstam?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed May 13 15:56:03 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 1jYrrf-000MUw-PV for guile-devel@m.gmane-mx.org; Wed, 13 May 2020 15:56:03 +0200 Original-Received: from localhost ([::1]:42274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYrre-0004Y6-S9 for guile-devel@m.gmane-mx.org; Wed, 13 May 2020 09:56:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYrrI-0004Xz-Fk for guile-devel@gnu.org; Wed, 13 May 2020 09:55:40 -0400 Original-Received: from fanzine.igalia.com ([178.60.130.6]:54202) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYrrG-0000xL-R6 for guile-devel@gnu.org; Wed, 13 May 2020 09:55:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=mnmC16F3+7sFSPgKH3ifIn0uvJ/NqFewjAqPmG2l6YY=; b=Z6cDpd5/zxL0bFv7BZ/x54crVztxNsAcxChfchJJ4Qowu/3WUDKUJWn9uM9l1uXzzHkdRcFcaomD7JJ+fBU4ByZraKL+O2hm1cTmcVDSMVuUDV87JFZU0xy27Hy4qPecM8WQxFCzpBVRTDf6eC+TaKL71QzsopTzbrPrNeqkjTjPK+Hoo/Ze1QwS629gF0TTCiQrH2xLERZTSysU1UKlQdNVN6b4TbdDMAcAm/qn5vnpxSqJEe01saCvcurpmVu33Hhg/A1Lbax6kwInCOI4C0KrzFk9qAtywcbv7zMtlgy4K+IflO4FVkGyyKm/O8F6DjMvca5M1jBYm9eWN4UJcQ==; Original-Received: from 82-65-63-215.subs.proxad.net ([82.65.63.215] helo=sparrow) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1jYrrD-0006mL-0c; Wed, 13 May 2020 15:55:35 +0200 In-Reply-To: <71bf4755-11b0-4211-abe7-677adc14db76@www.fastmail.com> ("Linus \=\?utf-8\?Q\?Bj\=C3\=B6rnstam\=22's\?\= message of "Wed, 13 May 2020 13:20:35 +0200") Received-SPF: neutral client-ip=178.60.130.6; envelope-from=wingo@pobox.com; helo=fanzine.igalia.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/13 09:55:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_NEUTRAL=0.779, 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:20516 Archived-At: Hi :) On Wed 13 May 2020 13:20, Linus Bj=C3=B6rnstam writes: > Hi there! > > Aleix and I noticed that equal? has a lot higher overhead than eqv? on > chars, which means using (ice-9 match) for chars was suboptimal. This > patch fixes that. I think we can be a little more simple here. Scheme doesn't specify what (eqv? #\a x) is, but in Guile it is equivalent to (eq? #\a x), and our compiler should be free to turn the portable eqv? invocation into eq?. But as the comment on line 416 says, we should really do this in peval and not in the expander. So.... you nerd-sniped me ;) I just pushed a patch that did this. While looking, I found this: > + (make-conditional src (make-primcall src prim (list a b)) > + (make-primcall src prim (cons b rest)) > + (make-const src #f)))))) This was in the original code but is wrong: if "b" has a side-effect, it will happen twice. I have fixed it in git. Thanks for the debugging and patch! Andy