emacs-devel
[Top][All Lists]
Advanced

[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: Fri, 10 Feb 2017 10:33:05 +0530

On Fri, Feb 10, 2017 at 9:47 AM, Clément Pit-Claudel
<address@hidden> wrote:
> On 2017-02-09 23:12, Vibhav Pant wrote:
>> The linear search code has been shifted to bytecode.c, since there
>> are a couple of assumptions about the jump table that we can't make
>> for a regular hash table, so regular gethash shouldn't be affected.
>
> That's unfortunate: linear scans for small hash tables sounded like a neat 
> optimization.
> What are the assumptions that make this unsuitable for regular gethash?


1. For jump tables, HASH_TABLE_SIZE (h) == h->count, so using h->count directly
saves the cost of an array lookup.
2. Since the size equals the count, we don't need to check whether
HASH_HASH (h, i)
(the hash code) is non nil in every pass of the linear search loop
(maphash needs to
do this, before calling the providing function).


-- 
Vibhav Pant
address@hidden



reply via email to

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