From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter navigation time grows as sqrt(line-number) Date: Fri, 18 Aug 2023 16:29:21 +0300 Message-ID: <7822ea29-10c1-fc3a-fe68-30011ae98db4@gutov.dev> References: <87v8ddsqwe.fsf@web.de> <797b4f1c-222e-14c0-c802-6f23090c9c1f@gutov.dev> <2fe95bcd-c3b5-09de-067d-fe986b01f890@gutov.dev> <878ra9u2b1.fsf@web.de> <3DA8CA36-7B5F-4992-BEDB-8D5699A47ABB@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15685"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: emacs-devel To: Yuan Fu , Felix Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 18 15:37:44 2023 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 1qWzfb-0003rl-M5 for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Aug 2023 15:37:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWzeg-0006GA-My; Fri, 18 Aug 2023 09:36:46 -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 1qWzXe-0003SC-3g for emacs-devel@gnu.org; Fri, 18 Aug 2023 09:29:31 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWzXb-000118-9u for emacs-devel@gnu.org; Fri, 18 Aug 2023 09:29:29 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 472A2320095D; Fri, 18 Aug 2023 09:29:24 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 18 Aug 2023 09:29:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1692365363; x=1692451763; bh=C3djFFI8mqfjOojrYv6A/s2zpuaUJM2WRpI vXuM1ogc=; b=l8IJ6dYYpFzu+3VFGlNOculfpm7vyQ+n4c3W4Z2NNItcR6pjzET O0o9VeZF1WG49PFZp1LfVw1MZFdSYWq8xzbQAp+gMxdJvjCYKPN0MVC7BMMM54pV jytJ9dLdoZpKx2J97/iPTSP+nne/OPAIFEyu7PMeY08FU8B0Em6ye2pXOyVUHaXq L37caWAJJQbRNWN2Q3KCD5aO+fkYeIPKUmktEbfz+YI5rBXSw0tFezeqA/jEOMJ7 nGTijMG+sjT9H0wjogJWBWsIPj7gSPfT5+TROuSKpSApwRP7GdOt9WZz/Axnr6hl SLXEwXnKQjICzfW9Ig/aOes/aAI3RTl7b4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1692365363; x=1692451763; bh=C3djFFI8mqfjOojrYv6A/s2zpuaUJM2WRpI vXuM1ogc=; b=oBY4/UsbDG3z0ZPlwwQucijC/wVdm715iRfamKQRqiMt+Rjklmw S/7ljSLbd6qBYoNYiE/OHJFNhATLPmj6E0cgzz1JGUOdINMaBZY2EDn1uk9snxQD RL/kQnGc/XhYaRLUSgY/WicT30qRH3rv1cTPz9h2tRZKy7w0cfFxfWSifXwzJ0pq vkLg1AeZXlKjN2FwnG2UOQxUOvzocrcimIv9wkgVqLz67/es4jE9hwSplyThJ8zX PWOQ0G9FPRiGpofojoMxkhwbAxlbDqaQKGqh0P2b9+Il2wbNkmRPfpn8sc3nlHAM YGVe3oeYOO3JU7IVj7W8X1gdU5YzVjvqvtA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddufedgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfevfhfhjggtgfesth ekredttdefjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehg uhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpefhffehleejffegffeugefhkeektd ffgfehjedvgeejtedtudehueffgffgfeejheenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 18 Aug 2023 09:29:22 -0400 (EDT) Content-Language: en-US In-Reply-To: <3DA8CA36-7B5F-4992-BEDB-8D5699A47ABB@gmail.com> Received-SPF: pass client-ip=64.147.123.25; envelope-from=dmitry@gutov.dev; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -62 X-Spam_score: -6.3 X-Spam_bar: ------ X-Spam_report: (-6.3 / 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, NICE_REPLY_A=-3.454, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308893 Archived-At: On 18/08/2023 05:49, Yuan Fu wrote: > So I guess the cursor stuff caused the crash. Not at all, the crash was entirely the fault of v1 of my patch (where I didn't check whether the returned node is_null. > But we shouldn’t fix it by using tree_sitter_node_parent, we purposefully replaced it using the cursor API, see bug#60054. Yeah, I've found this thread a little after posting the v2 patch. Even so, trying it out might be useful to see whether the built-in ts_node_parent is faster in some specific usage scenarios than what we currently have to use. If that is found to be the case, we'll know the potential direction for improvement, at least.