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: Thu, 18 Aug 2022 02:44:47 -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="17104"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "Ergus via Emacs development discussions." , =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= , Markus Triska , Theodor Thornhill To: jostein@kjonigsen.net Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 18 11:47:56 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 1oOc82-0004I5-Ud for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Aug 2022 11:47:54 +0200 Original-Received: from localhost ([::1]:46322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOc81-0000cr-Ti for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Aug 2022 05:47:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOc58-0005z1-95 for emacs-devel@gnu.org; Thu, 18 Aug 2022 05:44:54 -0400 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:40552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOc56-0006ul-MD for emacs-devel@gnu.org; Thu, 18 Aug 2022 05:44:53 -0400 Original-Received: by mail-pl1-x636.google.com with SMTP id x23so1070471pll.7 for ; Thu, 18 Aug 2022 02:44:52 -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=SU4uQ1jzW46HnRSU6W7XLD2ir8WjwQp0Lmyo06eNk2E=; b=Mj2rj/L/1Q/uTWoyPrpLQN092DL5km6NxRiYflWAip7mYbvvHUfkY8Kaig+aZ2jxOs Ac5jbqMUaJnyd+NAnanur4U4wpwyR88SqdwhLbx5ugoNaBrq6JGu5dJqpkZBgRps91e/ 1fdSORsscNBRos0pdMMnjqOsmz3g2w9L79Hdc0AB53cz9rf/DbsLlUTL3ZaeBy9icIm+ YttsvBk9mrHFInelIqGNFG8aggzZNMPttPdyJqOX2ZUZ53/lGPnXU0rneH4qo3l7W3V/ uK0jqu2JiaBo885Fa1pHvN1xTXJjt0NVCxjOgrb/mJ7/bIv1zOdGIt3heIQ09fBVre67 LlkQ== 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=SU4uQ1jzW46HnRSU6W7XLD2ir8WjwQp0Lmyo06eNk2E=; b=oh/e6mwyl/XXdAaIjKbcnlUx4Ljll/1G+Rc7d/YesjTFVWh0jCKrLEDOUJQ7Uu1gkh gzxmkz5zi2P/Zk7leuvwbeckuntEh9aa7+imVpWB3NLDwzR/xiyPs6KaRtw4XU5q8X5C jFhroFWqSsn5D+YZt5s0qoWxSoJJ4oehrmtHIcqzJjLQFumM26N8pfdpOoVUpreFzn8N zWcV1/ZJTvj3uew0JbLPjoxFdtOVMlwkLdbW4q17CfPbNDEA6qqmhFPMrGa4kNY7R4qR qViCZ/D+9OPQY3fsaz28vok8d+xRNe7FJ4CgZNv5phjonP6pCsuZso+eECOdzNlW9Ary w31A== X-Gm-Message-State: ACgBeo0pLrRH9sEZW7Rtd5lK6+aobRSpG6CQWTsysaXQ69VF5+m3UxA7 hU6+AYwbHj33QDaxu69a4aY= X-Google-Smtp-Source: AA6agR58gm0yBLlr1hgTKVPqp/PfcYlG31x0T5Tjq2Ps4ABg0XNsw+d60lCNXpyf7Zbcl5EhQTKEnA== X-Received: by 2002:a17:903:285:b0:16e:dcb7:937a with SMTP id j5-20020a170903028500b0016edcb7937amr1886481plr.4.1660815889938; Thu, 18 Aug 2022 02:44:49 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:b0da:b13a:ebcb:3b4]) by smtp.gmail.com with ESMTPSA id bj3-20020a056a02018300b0041d7ab5865dsm933705pgb.49.2022.08.18.02.44.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Aug 2022 02:44:49 -0700 (PDT) In-Reply-To: <7e24d0aa-9980-6204-5064-5a92963ae7bd@secure.kjonigsen.net> X-Mailer: Apple Mail (2.3696.100.31) Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=casouri@gmail.com; helo=mail-pl1-x636.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:293595 Archived-At: >=20 > Can something be done to Yuan's code to make it perform equally to = Thuan-Anh's? Are there improvements which can be done to linum-mode to = avoid these kinds of issues? >=20 > I know for sure I'm not qualified to answer those questions, but I = think it's definitely something which needs to be looked into and if = anyone has anything they want me to provide feedback on though, I will = be more than happy test those changes and report back. 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). I guess typescript-mode=E2=80=99s query pattern is short = enough to not bog down font-locking, but C#=E2=80=99s relatively large = set of patterns makes query captures very slow. I changed (setq csharp-mode-font-lock-settings-1 `((c-sharp ( ;; Various constructs (comment) @font-lock-comment-face (modifier) @font-lock-keyword-face (this_expression) @font-lock-keyword-face (escape_sequence) @font-lock-keyword-face =E2=80=A6 to (setq csharp-mode-font-lock-settings-1 `((c-sharp ,(treesit-query-compile 'c-sharp '( ;; Various constructs (comment) @font-lock-comment-face (modifier) @font-lock-keyword-face (this_expression) @font-lock-keyword-face (escape_sequence) @font-lock-keyword-face =E2=80=A6 And now csharp-mode is pretty fast! Yuan