From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: treesitter local parser: huge slowdown and memory usage in a long file Date: Tue, 13 Feb 2024 14:59:53 +0200 Message-ID: <861q9gr03a.fsf@gnu.org> References: <5991618.MhkbZ0Pkbq@fedora> <93F7DE13-0EC7-4A17-89B1-E07C99C6347B@gmail.com> <864jedsrjt.fsf@gnu.org> <2F0B4B85-5EAB-4285-BB6B-6CAF24EB96C3@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34118"; mail-complaints-to="usenet@ciao.gmane.io" Cc: v.pupillo@gmail.com, emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 13 14:00:15 2024 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 1rZsOU-0008b9-Ph for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Feb 2024 14:00:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZsOF-00079I-At; Tue, 13 Feb 2024 07:59:59 -0500 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 1rZsOD-000794-8q for emacs-devel@gnu.org; Tue, 13 Feb 2024 07:59:57 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZsOC-0004o8-Qz; Tue, 13 Feb 2024 07:59:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9RMGy1GbSnQB0rjYcjRP21vUKRStD5BoyY5QLa/D8OE=; b=RUqdftfxEleU 5srWAzm/gLSIRXJYQLUNAG8WBDbZtuTTnHK27S8uiMI1FQR9leSyLCvwVXQEPeMFufVGUqSxDOIZQ PIzSlChXhX9iOa3ZUxB9r2pR9ekp3/kM5mkCLZJCQW0Q8FETR3jWNz3GJAs8vcBT+Zjvh4Tn0q6/g cRYW7UP+wUwsXgd9Gv6cbiFSiwHg69M2wipQgzUH5OKxCbeWXUxNO/CtJpVzUYOStHdwJlbhbb0Ko Ryk5PEaKM/TvClM6LrtVmTW5+maRdFUTye8TzbssKdidj3Na5ThBjLYOb2r/h0Ctde8gVjZNlY7U/ UfOrBXco+Vg4mVU3SDNmoQ==; In-Reply-To: <2F0B4B85-5EAB-4285-BB6B-6CAF24EB96C3@gmail.com> (message from Yuan Fu on Tue, 13 Feb 2024 00:15:49 -0800) 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:316173 Archived-At: > From: Yuan Fu > Date: Tue, 13 Feb 2024 00:15:49 -0800 > Cc: Vincenzo Pupillo , > emacs-devel@gnu.org > > > So my suggestion would be to define the range from position of point, > > using the window dimensions; see get_narrowed_width for ideas. This > > could lose if the buffer has a lot of invisible text, so I suggest to > > check for invisible properties, and if they are present in the buffer, > > punt and use the whole accessible portion of the buffer (I don't > > expect PHP buffers, or any buffers in programming-language modes, to > > have invisible text). > > Ah, clever :-) Programming language buffers could have invisible text when the user uses hideshow, or folded some section of code using outline-minor-mode :-( If having invisible text in such buffers is frequent enough, you could look for the first position before the region beginning that is visible, and the first position after the region end that is visible, and use that as the range.