[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] feature/byte-switch 086c4ea: * src/bytecode.c: (exec_b
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] feature/byte-switch 086c4ea: * src/bytecode.c: (exec_byte_code) Use hash_lookup for Bswitch |
Date: |
Thu, 19 Jan 2017 11:34:22 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> On another thought, `byte-switch` is used while compiling certain
> `cond` forms. It
> replaces the traditional goto-if-nil bytecode by using a hash table mapping
> values to addresses/tags to be jumped to. Since `byte-switch` is essentially a
> "dynamic" goto (in the sense that the address/tag cannot be known at
> compile time),
> wouldn't doing a runtime type check in the bytecode VM for what is a
> hash table lookup + goto have a significant performance penalty?
I don't know. Only measurement can tell. My guess is that hash_lookup
already takes a significant amount of time, so a HASH_TABLE_P test would be
negligible in comparison.
Stefan
> On Wed, Jan 18, 2017 at 11:18 PM, Stefan Monnier
> <address@hidden> wrote:
>>> * src/bytecode.c: (exec_byte_code) Use hash_lookup for Bswitch
>>> Fgethash type checks the provided table object, which is unnecessary
>>> for compiled bytecode.
>>
>> While it's true that we can cause a core dump of Emacs if we feed it an
>> invalid .elc file, that's a "feature" I'd rather shrink rather
>> than generalize.
>>
>>
>> Stefan
> --
> Vibhav Pant
> address@hidden