From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Vibhav Pant <vibhavp@gmail.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
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 [thread overview]
Message-ID: <jwvd1fjau78.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <CA+T2Sh3yww1NF_pmhkD5FD56qsGC7WF=o+62pAvEKjaZMGTZ4w@mail.gmail.com> (Vibhav Pant's message of "Thu, 19 Jan 2017 17:46:16 +0530")
> 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
> <monnier@iro.umontreal.ca> 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
> vibhavp@gmail.com
next prev parent reply other threads:[~2017-01-19 16:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170118171311.10996.72260@vcs.savannah.gnu.org>
[not found] ` <20170118171311.A84EA220125@vcs.savannah.gnu.org>
2017-01-18 17:48 ` [Emacs-diffs] feature/byte-switch 086c4ea: * src/bytecode.c: (exec_byte_code) Use hash_lookup for Bswitch Stefan Monnier
2017-01-18 18:19 ` Vibhav Pant
2017-01-19 12:16 ` Vibhav Pant
2017-01-19 16:34 ` Stefan Monnier [this message]
2017-01-19 17:53 ` Vibhav Pant
2017-01-20 9:10 ` Daniel Colascione
2017-01-20 14:53 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvd1fjau78.fsf-monnier+emacsdiffs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=vibhavp@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.