bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#36139: [PATCH] Make better use of the switch op in cond forms


From: Mattias Engdegård
Subject: bug#36139: [PATCH] Make better use of the switch op in cond forms
Date: Wed, 19 Jun 2019 16:03:43 +0200

18 juni 2019 kl. 21.03 skrev Stefan Monnier <monnier@iro.umontreal.ca>:
> 
> LGTM.  The other direction is to just always use `member`
> and speed up the implementation of `member` by testing the type of
> the first arg and dispatch to memq/memql when possible.

Here is a patch that does some cheap static optimisations: equal/eql and 
member/memql become eq and memq if constant symbols are involved. (Works for 
me, bootstraps fine, etc.)

I considered doing the same for equal->eql and member->memql. It turns out that 
equal is faster than eql for numbers, since eql doesn't have its own byte op. 
For the same reason, member is faster than memql for lists of up to 5 elements 
(on this machine). While we could reduce equal to eql for constant lists > 5 
elements of only symbols and numbers, it's perhaps more trouble than it's worth.

Attachment: 0001-Strength-reduce-equal-eql-member-and-memql.patch
Description: Binary data


reply via email to

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