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: Stefan Monnier
Subject: Re: [PATCH]: Add new bytecode op `switch' for implementing branch tables.
Date: Fri, 10 Feb 2017 10:12:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>>> 1. For jump tables, HASH_TABLE_SIZE (h) == h->count, so using h->count
>>> directly saves the cost of an array lookup.
>> That doesn't invalidate the usefulness of a linear search.
> Sure, but that makes it better (IMO) to have separate code for linear
> searching the jump table.

You mean to have a copy of the search in bytecode.c?  I guess that's
fine, I'm talking about the behavior of `gethash` only.

>> The linear search should compare HASH_HASH(h, i) to the search key's
>> hash anyway, so this comparison against nil is not needed.
> Is that strictly needed, though?

No, it's an optimisation to avoid calling Fequal unnecessarily.


        Stefan




reply via email to

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