emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

treesitter local parser: huge slowdown and memory usage in a long file


From: Vincenzo Pupillo
Subject: treesitter local parser: huge slowdown and memory usage in a long file
Date: Sun, 11 Feb 2024 22:53:00 +0100

Hi, 
as a benchmark for my php-ts-mode (in 2 variants: one with tree-sitter-phpdoc 
for php comment block, and another using regular expression for comment block) 
I use tcpdf.php (from the tcpdf library). This php file has 24730 lines and 
generates 669 parser ranges, 665 of which are for phpdoc. 

As you can see from the profile (I try to edit the comment on line 2350) that I 
attached, the problem is in treesit--pre-redisplay.
I tried playing around with the code a bit but to no avail (for example, I 
limited treesit-update-ranges to window-start and window-end). 
comments say:
    ;; Force repase on _all_ the parsers might not be necessary, but
    ;; this is probably the most robust way.
  
Any ideas?
My php-ts-mode (It's a working progress) is available here: 
https://github.com/vpxyz/php-ts-mode

Thanks
V.

p.s without phpdoc emacs is as fast as with short php files.
p.p.s. nvim with treesitter is as slow as my major mode with this file.

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo 
version 1.18.0) of 2024-02-11

Attachment: cpu_profiler_report
Description: Text document

Attachment: mem_profiler_report
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]