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: [PATCH]: Add new bytecode op `switch' for implementing branch tables. Date: Fri, 10 Feb 2017 10:12:02 -0500 Message-ID: References: <1b07c68a-873e-83c8-246d-423bc83a3881@gmail.com> <712df469-190d-aeab-e239-1f225be3333f@gmail.com> <25a6003d-1d9b-381f-29b0-aece30af1def@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486739546 3624 195.159.176.226 (10 Feb 2017 15:12:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2017 15:12:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 10 16:12:22 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 1ccCs2-0000V6-6q for ged-emacs-devel@m.gmane.org; Fri, 10 Feb 2017 16:12:22 +0100 Original-Received: from localhost ([::1]:44364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccCs4-0003XT-JC for ged-emacs-devel@m.gmane.org; Fri, 10 Feb 2017 10:12:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccCrv-0003VI-CV for emacs-devel@gnu.org; Fri, 10 Feb 2017 10:12:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccCrr-0004HA-8u for emacs-devel@gnu.org; Fri, 10 Feb 2017 10:12:15 -0500 Original-Received: from [195.159.176.226] (port=40388 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccCrr-0004H2-20 for emacs-devel@gnu.org; Fri, 10 Feb 2017 10:12:11 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ccCri-000842-7a for emacs-devel@gnu.org; Fri, 10 Feb 2017 16:12:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 17 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:+WXXtggH6htz51B/7Joe6dC45fM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:212207 Archived-At: >>> 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