From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Vibhav Pant Newsgroups: gmane.emacs.devel Subject: Re: [PATCH]: Add new bytecode op `switch' for implementing branch tables. Date: Tue, 7 Feb 2017 20:51:28 +0530 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114d72ea5668370547f24dbb X-Trace: blaine.gmane.org 1486482535 23668 195.159.176.226 (7 Feb 2017 15:48:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2017 15:48:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 07 16:48:50 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 1cb80e-0005s0-Qt for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2017 16:48:48 +0100 Original-Received: from localhost ([::1]:54959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb80k-0002B0-Bm for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2017 10:48:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb7aE-0005Z0-Gh for emacs-devel@gnu.org; Tue, 07 Feb 2017 10:21:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cb7aD-0002Jv-Dy for emacs-devel@gnu.org; Tue, 07 Feb 2017 10:21:30 -0500 Original-Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:35637) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cb7aD-0002JH-82 for emacs-devel@gnu.org; Tue, 07 Feb 2017 10:21:29 -0500 Original-Received: by mail-yw0-x242.google.com with SMTP id l16so9662916ywb.2 for ; Tue, 07 Feb 2017 07:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=E6UB1l/Y6Y86XD4WjwABHkWAGmN5njv5jv3zxhAIibo=; b=naA3oEFE7o+ELBi4stuT0NRRbXOm5j7rmt4JthcN4pO5OV8BtJdtNIYyfMmPMUqSZh jBj1b/RshxRU0GslFyXZQdD7wo6X0Hmz144RSBh57NOoTKg/BHnMtGyg9Hy3ZRqLsDmq 9dmG5uQjORk86dAF1KXNThPucaxdNMoWHOSg/nJOpX5lgB6IBN+lfCj+3fkGqjN5JQli N0u2rtJBBvMATnF4rKYUwCjEvPV9d6jq4C0LY7KPEndHHUh7Q4EdbkbQ2M+BSCG09Aeb b5eHkRi0iKz4yTaNGa7zglpQJcgP9PTn5k7se34ZKOk/hvDBtIl3nyg/5ysFMATwPzY5 Z3oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=E6UB1l/Y6Y86XD4WjwABHkWAGmN5njv5jv3zxhAIibo=; b=OYOWAgKKnbbWdsxoemCfX5sySNJ8fZFyUu9OKJVApRMrMwktfJc3Whn7Qg1lqgcrg0 nj7h4Z8qE3R/Hn+n2PhDkw3ckd6I8hE1oH+UKVYZ8BJDRHdnKKK6dhxo8F2RNp7k3hD8 tNgNMuPSnFDCsqnmsrC5T0XG4+04FJBJFWBNrLURzm60Wev/wsU1OxpAvhhUCZ0sVGP3 jrQVZgTMfqKBU1rGIkUQqX3g1phN9A/jjN30EUvX41K9n3yl/L1/Uowu+UruQ3nliACm m1i4FGlEfsbKCVH+LJtN6miixKWNkrCZpswzFbQY6pu20hzi/AvQuC5FIaQzKSZFNpC6 PSTw== X-Gm-Message-State: AIkVDXLg4dDrLPMg7VC2qq55GcEXSFUyzkLwOkIDkLFE6nuUPOsa20Ry+iqqvcMOGgOnJNtCxss6MoUzPGHXQw== X-Received: by 10.129.71.11 with SMTP id u11mr11062256ywa.79.1486480888716; Tue, 07 Feb 2017 07:21:28 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Tue, 7 Feb 2017 07:21:28 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Tue, 7 Feb 2017 07:21:28 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 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:212098 Archived-At: --001a114d72ea5668370547f24dbb Content-Type: text/plain; charset=UTF-8 On 07-Feb-2017 8:11 PM, "Stefan Monnier" wrote: >> Hmm... so goto-if-nil is never used any more? Aren't there cases where >> byte-switch results in slower code than goto-if-nil? > Once linear search for gethash when the number of keys are small is > implemented, byte-switch should still be faster, as all byte-goto-if-nil > and byte-goto-if-nil-else-pop bytecode is "replaced" with native linear > search code. Does that mean you answered "yes" to the first question? I thought goto-if-nil is also used in other circumstances. No. goto-if-nil is still used to compile `if` and other conditional forms. It's also used for cond forms which cannot use byte-switch, like: (cond ((eq v 1) 'foo) ((stringp v) 'bar)) Or forms where some not all clauses use the same test function, since the hash table can only use a single test. --001a114d72ea5668370547f24dbb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On 07-Feb-2017 8:11 PM, "Stefan Monnier" <monnier@iro.umontreal.c= a> wrote:
>> Hmm...= so goto-if-nil is never used any more?=C2=A0 Aren't there cases where<= br> >> byte-switch results in slower code than goto-if-nil?
> Once linear search for gethash when the number of keys are small is > implemented, byte-switch should still be faster, as all byte-goto-if-n= il
> and byte-goto-if-nil-else-pop bytecode is "replaced" with na= tive linear
> search code.

Does that mean you answered "yes" to the first question? I thought goto-if-nil is also used in other circumstances.

No. goto-if-nil= is still used to compile `if` and other conditional forms. It's also u= sed for cond forms which cannot use byte-switch, like:
(cond ((eq v 1) 'foo)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ((stringp v) 'bar))
Or form= s where some not all clauses use the same test function, since the hash tab= le can only use a single test.
--001a114d72ea5668370547f24dbb--