guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add tree-il optimizations for equal? on char and number lite


From: Andy Wingo
Subject: Re: [PATCH] Add tree-il optimizations for equal? on char and number literals
Date: Wed, 13 May 2020 15:55:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi :)

On Wed 13 May 2020 13:20, Linus Björnstam <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]