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 19:20:35 +0530 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=94eb2c0819f885cf300547f10990 X-Trace: blaine.gmane.org 1486475836 1397 195.159.176.226 (7 Feb 2017 13:57:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2017 13:57:16 +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 14:57:10 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 1cb6Ga-0008T4-Q1 for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2017 14:57:08 +0100 Original-Received: from localhost ([::1]:54143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb6Gg-0003SB-7D for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2017 08:57:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb6Ab-00066t-Lj for emacs-devel@gnu.org; Tue, 07 Feb 2017 08:50:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cb6Aa-000764-Rq for emacs-devel@gnu.org; Tue, 07 Feb 2017 08:50:57 -0500 Original-Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]:36097) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cb6Aa-00075i-O2 for emacs-devel@gnu.org; Tue, 07 Feb 2017 08:50:56 -0500 Original-Received: by mail-yw0-x244.google.com with SMTP id q71so9420629ywg.3 for ; Tue, 07 Feb 2017 05:50:56 -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=lmFuyn3zjS9ecnSQ4RKVeOGzxOtfmEVf0O+AredgLj0=; b=UqIldxCGAeV3kyBHEQBnJr5G8b4Lpmc42UyzNFW2Vo1+Fstrf6qjrEl6yzxhgmURtF FJmmAdnYpOh/g3mxkJ9mdltgdQbLmG/oV4ntEzsyACQAqCGPTaQ2DkCo7Wvn2lgNSO9h d65D0jsqSzM9y22wDQzEcomHRIzRrw+kt+U8HKlXaTDvCa2dGA8T517rEI29JGo33skH nymJA+nipkPP/wC68xlEclUVzhRBin57qxl13CNTC+sEW3Z1PFgBx5QhSj8G6JmB2ylV kCipOrjCSE7IDPDtIfGFnr3f0kJwhsKBDhXOkVXShUHznzV15a0L/PhajQA0XUc91oSu 5k9Q== 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=lmFuyn3zjS9ecnSQ4RKVeOGzxOtfmEVf0O+AredgLj0=; b=mHI8WYEy4C3J5Xtjz6IEVv/kPx7RQADLz5qDJvsECzZP7z+g5eX8SvzSvxXRrGAgO1 FT6Nwv/ICsxitUm+Unya1dqyivEsLA/M24wfzzfbx9E7VURIjXD4j3+jkp7BewN3A3Ss bd/D92qaDx2gEcEUycFcD/YkVByG9re0yZApoQzPry95szl6Mlqpfhci/1UJaLqZBWOO rVmxF32I2hHHKhmWHKrOXudoRk9cr77sQclyfiAkkEHVKTe6QoClqlEnYERPPrmz1yhy EjUc42MAL+Hc4Y09aYLrX5XxFJ5tLVRP/UVnfScpUfccFuRzBh7kGy0fBruz7BItoJZl ccqQ== X-Gm-Message-State: AIkVDXKarGjacptBILqZRIqYzrmDBv6YH9H7d4TWl746TDdbzrntw700KvywTAFZ3sUeLlMwtcLTbCSwf/I/Rg== X-Received: by 10.13.218.195 with SMTP id c186mr11216926ywe.15.1486475455997; Tue, 07 Feb 2017 05:50:55 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Tue, 7 Feb 2017 05:50:35 -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::244 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:212089 Archived-At: --94eb2c0819f885cf300547f10990 Content-Type: text/plain; charset=UTF-8 On Tue, Feb 7, 2017 at 12:00 AM, Stefan Monnier wrote: >> The following patch adds support for a new op `switch` to the Emacs >> bytecode VM and compiler. > > I guess the motivation is to speed up some code. > Did you make any measurements to see what kind of effect it has? The attached benchmark code took 9.409541956 seconds when compiled without switch, and 0.20807168799999998 seconds (97% speedup) when compiled with switch. It generates a cond clause with a thousand clauses comparing a variable with random integer values, with the last clause containing the actual value. However, since it's a synthetic benchmark, real world code should be better indicator of performance improvement. -- Vibhav Pant vibhavp@gmail.com --94eb2c0819f885cf300547f10990 Content-Type: text/x-emacs-lisp; charset=US-ASCII; name="switch-benchmark.el" Content-Disposition: attachment; filename="switch-benchmark.el" Content-Transfer-Encoding: base64 X-Attachment-Id: f_iyvl03np0 KHJlcXVpcmUgJ2NsLWxpYikKKHJlcXVpcmUgJ2JlbmNobWFyaykKCihkZWZtYWNybyByYW5kb20t Y2FzZXMgKGNhc2VzIHZhciBhY3R1YWwtdmFsdWUpCiAgYChjb25kICxAKGNsLWxvb3AgZm9yIGkg ZnJvbSAwIHRvIGNhc2VzCgkJICAgIGNvbGxlY3QgYCgoZXEgLHZhciAsKHJhbmRvbSkpICxpKSkK CSAoKGVxICx2YXIgLGFjdHVhbC12YWx1ZSkgdCkpKQoKKG1lc3NhZ2UgIiVzIgoJIChiZW5jaG1h cmstcnVuLWNvbXBpbGVkIDEwMDAwMCAobGV0ICgodiAyKSkgKHJhbmRvbS1jYXNlcyAzMDAwIHYg MikpKSkK --94eb2c0819f885cf300547f10990--