From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel 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 Message-ID: References: <20170118171311.10996.72260@vcs.savannah.gnu.org> <20170118171311.A84EA220125@vcs.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1484843831 23307 195.159.176.226 (19 Jan 2017 16:37:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2017 16:37:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: "emacs-devel@gnu.org" To: Vibhav Pant Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 19 17:37:05 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUFhq-0004zX-EJ for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2017 17:36:58 +0100 Original-Received: from localhost ([::1]:49500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUFhv-0005pA-1g for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2017 11:37:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUFfT-0004PS-SG for emacs-devel@gnu.org; Thu, 19 Jan 2017 11:34:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUFfO-0004gr-QG for emacs-devel@gnu.org; Thu, 19 Jan 2017 11:34:31 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:40175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUFfO-0004gd-Js for emacs-devel@gnu.org; Thu, 19 Jan 2017 11:34:26 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v0JGYM3G028846; Thu, 19 Jan 2017 11:34:22 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 6C79261B87; Thu, 19 Jan 2017 11:34:22 -0500 (EST) In-Reply-To: (Vibhav Pant's message of "Thu, 19 Jan 2017 17:46:16 +0530") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV5925=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5925> : inlines <5636> : streams <1729771> : uri <2360669> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211405 Archived-At: > 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 > 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