From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter integration on feature/tree-sitter (severe performance issues together with linum-mode) Date: Fri, 19 Aug 2022 14:58:49 -0700 Message-ID: References: <7e24d0aa-9980-6204-5064-5a92963ae7bd@secure.kjonigsen.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) 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="26418"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "Ergus via Emacs development discussions." , =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= , Markus Triska , Theodor Thornhill , dgutov@yandex.ru To: jostein@kjonigsen.net Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 19 23:59:52 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oPA1w-0006gv-8J for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Aug 2022 23:59:52 +0200 Original-Received: from localhost ([::1]:56722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oPA1v-0000Ib-6P for ged-emacs-devel@m.gmane-mx.org; Fri, 19 Aug 2022 17:59:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oPA13-0007v4-2S for emacs-devel@gnu.org; Fri, 19 Aug 2022 17:58:57 -0400 Original-Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:35617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oPA11-0002p2-B2 for emacs-devel@gnu.org; Fri, 19 Aug 2022 17:58:56 -0400 Original-Received: by mail-pg1-x52e.google.com with SMTP id r69so4681734pgr.2 for ; Fri, 19 Aug 2022 14:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc; bh=R37uyJ82nGJO+2FX0fW0+OHmnf3RF72pbMZgfNnlqzw=; b=LGq4BgWRRYoKJ3GAc2+hNzhY2mUHfRHizAL1OvxaZhghyIv8VTmyvgflCIw0+flPUj 9Ib8Rwzg5Y03Ix1HntUaAD15lDn8n3u6og/OdsdPyZ/3SiicPWjqzIaQM3OPwjohD6tP wX9xHA/y8abRxxMHQw6fFXKTIj78S063WaYRXfnFuR+902bmhbcqcoMAfrmLTidY8ulL w5+5z2g66AbjJ21HeoVvzSihYf1M4YIYam33sNrrLdxgkf3kraMKqbrT21FIxWMSv6hF 7YoijWr4LpHJP1RJATmky2tO5RQtFRncVnK1aQ+5SozuNZMyO5KuCidyXNpORL5xkMnO Goyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc; bh=R37uyJ82nGJO+2FX0fW0+OHmnf3RF72pbMZgfNnlqzw=; b=D9lfnTRNZEoqYFnnWiWp4WPM8BL0l19pBYYzHXHAJwesEAUHxg0c29zmvUwLLWQ7RD DHbQpgJTRhWFAO1HL2UuNZGBvfBvFHjxh60/Z0ysBya36lOswJq0cpTlAJySBisuJQmw 3AM+awR5dY3HW4lGKKv4nWz6HDA66M2/XWBa4x1YM1HIkzJ6vMBL2s99hYFiq3oO4AqA JJv7xTAa9N3hWjGZSoMnaOyjdPSn/6Uc9gLG4VkokdfUiHiBHfnsSbydreKsH8YIdHWW pVWh2swxam1hj/Ms7gG0x1u8plTnklQMZ6VjwqEUHBDu1Z+JOMmJdSWowLDUrBix/Bkp NcLQ== X-Gm-Message-State: ACgBeo3g+/23dTJh1xRPzOrViIOAOdLOHzp+6ogfSIQMfDmnz4xiSWoH UvTrkdXUG11CspjBXKRhqao= X-Google-Smtp-Source: AA6agR57XFS1bMjZ149hldtUe8wyotDSk1x057s5WTYKhtiVb+hLbDvxmQS6xLKp8yCHlbNLyNdUEw== X-Received: by 2002:a63:2c8b:0:b0:41c:5f9e:a1d6 with SMTP id s133-20020a632c8b000000b0041c5f9ea1d6mr7669149pgs.601.1660946332137; Fri, 19 Aug 2022 14:58:52 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:987e:4bb5:56e0:a674]) by smtp.gmail.com with ESMTPSA id x61-20020a17090a6c4300b001f02a72f29csm3601700pjj.8.2022.08.19.14.58.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Aug 2022 14:58:51 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.100.31) Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=casouri@gmail.com; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:293654 Archived-At: > On Aug 18, 2022, at 11:01 PM, Jostein Kj=C3=B8nigsen = wrote: >=20 > On 18.08.2022 11:44, Yuan Fu wrote: >>=20 >> Good news, the slowness can be easily resolved by compiling the query = pattern in csharp-mode-font-lock-settings-1 (this is a recent addition = to treesit). >>=20 >> Yuan >>=20 > Thanks for the reply and thanks for looking into this. >=20 > I can confirm that by compiling the query like you suggested, and = replacing linum-mode with nlinum-mode, I'm not experiencing any = performance issues any more! >=20 > To avoid issues like this... Should perhaps the function = treesit-query-capture (in treesit.c) emit a warning/message when = encountering non-compiled queries? >=20 > That way writing more performant major-modes would be more = self-explanatory, resulting in a better, faster Emacs for everyone. Warning/message seems a bit drastic. There are valid use-cases where one = want to use an uncompiled query. For now I have words in the docstring = that advices using compiled queries (albeit not in all caps :-) Yuan=