unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: "Linus Björnstam" <linus.bjornstam@veryfast.biz>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] Add tree-il optimizations for equal? on char and number literals
Date: Wed, 13 May 2020 15:55:23 +0200	[thread overview]
Message-ID: <8736849bxw.fsf@pobox.com> (raw)
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")

Hi :)

On Wed 13 May 2020 13:20, Linus Björnstam <linus.bjornstam@veryfast.biz> 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



  reply	other threads:[~2020-05-13 13:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 11:20 [PATCH] Add tree-il optimizations for equal? on char and number literals Linus Björnstam
2020-05-13 13:55 ` Andy Wingo [this message]
2020-05-13 16:33   ` Arne Babenhauserheide
2020-05-13 21:16   ` Linus Björnstam
2020-05-14  8:38     ` Andy Wingo
2020-05-14 18:14       ` 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=8736849bxw.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=linus.bjornstam@veryfast.biz \
    /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).