[Top][All Lists]

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

Re: [PATCH]: Add new bytecode op `switch' for implementing branch tables

From: Vibhav Pant
Subject: Re: [PATCH]: Add new bytecode op `switch' for implementing branch tables.
Date: Tue, 7 Feb 2017 20:51:28 +0530

On 07-Feb-2017 8:11 PM, "Stefan Monnier" <address@hidden> wrote:
>> Hmm... so goto-if-nil is never used any more?  Aren't there cases where
>> byte-switch results in slower code than goto-if-nil?
> Once linear search for gethash when the number of keys are small is
> implemented, byte-switch should still be faster, as all byte-goto-if-nil
> and byte-goto-if-nil-else-pop bytecode is "replaced" with native linear
> search code.

Does that mean you answered "yes" to the first question?
I thought goto-if-nil is also used in other circumstances.

No. goto-if-nil is still used to compile `if` and other conditional forms. It's also used for cond forms which cannot use byte-switch, like:
(cond ((eq v 1) 'foo)
            ((stringp v) 'bar))
Or forms where some not all clauses use the same test function, since the hash table can only use a single test.

reply via email to

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