From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#62368: 29.0.60; Evaluating predicates before creating captured nodes in treesit-query-capture Date: Mon, 11 Sep 2023 17:05:48 -0700 Message-ID: References: <09A7EAB7-332E-4123-A6DB-8921FBD325C4@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26331"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62368@debbugs.gnu.org, Dmitry Gutov To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 12 02:07:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qfqvz-0006el-4M for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Sep 2023 02:07:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfqvp-0006IN-1O; Mon, 11 Sep 2023 20:07:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfqvi-0006Hl-Dq for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 20:06:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfqvh-0003cK-Om for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 20:06:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfqvm-0006Vy-0V for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 20:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 00:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62368 X-GNU-PR-Package: emacs Original-Received: via spool by 62368-submit@debbugs.gnu.org id=B62368.169447716224942 (code B ref 62368); Tue, 12 Sep 2023 00:07:01 +0000 Original-Received: (at 62368) by debbugs.gnu.org; 12 Sep 2023 00:06:02 +0000 Original-Received: from localhost ([127.0.0.1]:55327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfqun-0006U5-OV for submit@debbugs.gnu.org; Mon, 11 Sep 2023 20:06:02 -0400 Original-Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]:42256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfqum-0006Ti-6H for 62368@debbugs.gnu.org; Mon, 11 Sep 2023 20:06:00 -0400 Original-Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2bcb54226e7so61093671fa.1 for <62368@debbugs.gnu.org>; Mon, 11 Sep 2023 17:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694477149; x=1695081949; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=TvC9SzfVH13sAljg42M1lCLq8CgefUfVJYglJovTzEM=; b=lpxXANHkOmt8I1okSNw7GmWR/otEgxhJ+kyVRHNXFWxgSXmfScLjZQFWmOo87/VMT4 j1RFLbzMjWft1J9VzfFTGcz7zxl43OHOxY2Tz4sSemQOpRhebg7HrZWwVC+wld0iqT49 uKOrnwyAyHZeIfWs3CmFaxvJno2QyAIcA4P1Nci6bgfHNoomGyVwgDJSf5tqBAV4qS+O 7Vfr7RNYRVxuKAyT7SEQ90GmgSZ93bXNwy8e9NQrYCNrOFm5D9G9D5Fk06dtCDRbQwtV Srez+r1v4mSldF+Fvar34RIhqPsUx3wJXRjpRgvH2EIRT7OQqCEXX+xUPXjKcWPkfUBF kwFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694477149; x=1695081949; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=TvC9SzfVH13sAljg42M1lCLq8CgefUfVJYglJovTzEM=; b=O9Gsf8lvc6TaWRIZGdvwqeKYX3cy+zzfqNKJvZSqckwzi9QwhmJTMvWQ2C0znjRlBk qA5E4Ihy9NkyDohgj5p/KVhhnnsMN4EKgz9s8tLpKYUbGX99JlO3ZXqA3TiMuY03bGWA KgH8/NJZyN+H5OIBO6RZ6dVy4+kHDMQbaqSlvgcQt+QxYBsP0GbMfTroLrHgWy1+YXDi pdMSJh92bEZUbyZ7FSUlNg1U3sdDaNu66vNP3WFyr5azt8fxS3x7x8Xam63wsJC6ibf8 BiHwT40wyRcC3QkT2HPJKZBhlYBMynxHVZQf5vtysBl08HY/MxQkfMhkBhb0yuNKASYT OETA== X-Gm-Message-State: AOJu0YyoCT0Gq2hNBCeULxp/Bvbw1bjZbj8r2g7sGeT2MwOv+McsU55L Zrb58nV6ec9it53BjaFi3jIuAYFiP2XJq5jMDD8= X-Google-Smtp-Source: AGHT+IGG3HUwaLu1/cScXLmCPPYGQpAAO8SWUNJ0fe5rLkQPyvYySYSXpQ0r7xQEuYQmJ+T0w6t8V9muVlTBDgIba20= X-Received: by 2002:a2e:a276:0:b0:2bd:7bd:1a45 with SMTP id k22-20020a2ea276000000b002bd07bd1a45mr415869ljm.13.1694477148775; Mon, 11 Sep 2023 17:05:48 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 11 Sep 2023 17:05:48 -0700 In-Reply-To: (Yuan Fu's message of "Wed, 22 Mar 2023 20:16:14 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270111 Archived-At: Yuan Fu writes: >> On Mar 22, 2023, at 5:42 PM, Dmitry Gutov wrote: >> >> Hi Yuan! >> >> On 22/03/2023 06:49, Yuan Fu wrote: >>> X-Debbugs-CC:dgutov@yandex.ru Dmitry, when you have time, could you >>> try your benchmark in bug#60953 with this patch? I made predicates >>> evaluate before we create any nodes, so #equal and #match should be >>> more efficient now, when there are a lot of rejections. In the same >>> time #pred is made slightly worst since they now create a lisp node >>> and discard it. (But this can be fixed with a little more >>> complexity.) >> >> Thank you, I was curious what would the improvement be if we could >> delay allocation of node structures until :match is checked. >> >> But for my benchmark the difference is on the order of 4-5%. It seems >> we are scraping the barrel in terms of improving allocations/reducing >> GC because according to 'benchmark-run', where the whole run of a 100 >> iterations of the scenario takes ~1.1s, the time spent in GC is >> 0.150s. And the improved version takes like 1.04s, with 0.1s in GC. >> >> So if you ask me, I think I'd prefer to hold off on applying this >> patch until we either find scenarios where the improvement is more >> significant, or we find and eliminate some other bigger bottleneck >> first, after which these 5% grow to become 10-20% or more, of >> remaining runtime. The current approach is pretty Lisp-y, so I kind >> of like it. >> >> And there's the issue of #pred, of course, which which could swing >> the difference in the other direction (I didn't test any code which >> uses it). >> >> We could also try a smaller change: where the initial list of conses >> for result is build with capture_id's in car's, and then substituted >> with capture_name if the predicates all match. Then tthe treesit_node >> pseudovectors would still be created eagerly, though. > > Thank you very much! Yeah, it doesn=E2=80=99t seem to worth it. I guess w= e can > keep this in our back sleeve for now ;-) > > I think using symbols is fine for now, since I don=E2=80=99t think it wou= ld > make much difference. So should this bug be closed, then?