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 01:07:00 -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 1486707025 29325 195.159.176.226 (10 Feb 2017 06:10:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2017 06:10:25 +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 07:10:21 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 1cc4PT-0007Kg-Jw for ged-emacs-devel@m.gmane.org; Fri, 10 Feb 2017 07:10:19 +0100 Original-Received: from localhost ([::1]:42087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cc4PY-0004pI-V4 for ged-emacs-devel@m.gmane.org; Fri, 10 Feb 2017 01:10:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cc4PP-0004nf-KU for emacs-devel@gnu.org; Fri, 10 Feb 2017 01:10:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cc4PN-0007sY-4G for emacs-devel@gnu.org; Fri, 10 Feb 2017 01:10:15 -0500 Original-Received: from [195.159.176.226] (port=49837 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cc4PM-0007s1-U5 for emacs-devel@gnu.org; Fri, 10 Feb 2017 01:10:13 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cc4PE-0006Sk-8O for emacs-devel@gnu.org; Fri, 10 Feb 2017 07:10:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 15 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:QoBACHMpzUQTWARyWHNUKltpUxY= 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:212201 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. > 2. Since the size equals the count, we don't need to check whether > HASH_HASH (h, i) (the hash code) is non nil in every pass of the > linear search loop (maphash needs to do this, before calling the > providing function). The linear search should compare HASH_HASH(h, i) to the search key's hash anyway, so this comparison against nil is not needed. Stefan