emacs-devel
[Top][All Lists]
Advanced

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

Re: Reliable after-change-functions (via: Using incremental parsing in E


From: Tuấn Anh Nguyễn
Subject: Re: Reliable after-change-functions (via: Using incremental parsing in Emacs)
Date: Wed, 1 Apr 2020 13:17:42 +0700



On Wed, Apr 1, 2020 at 12:50 AM Eli Zaretskii <address@hidden> wrote:
> From: Tuấn Anh Nguyễn <address@hidden>
> Date: Wed, 1 Apr 2020 00:07:27 +0700
>
> > xdisp.c comes to mind, obviously.
>
> On my machine, a 3.39 GHz Intel Core i7:
>
>     (0.150791 0 0.0) ; 1 full parse

How did you submit xdisp.c to the parser?
 
    (with-current-buffer "xdisp.c"
      (let ((language (tree-sitter-require 'c))
            (parser (ts-make-parser)))
        (ts-set-language parser language)
        (garbage-collect)
        (message "%s" (benchmark-run (ts-parse parser #'ts-buffer-input nil)))))


In any case, IIUC, the first time a buffer needs to be displayed, we
need to wait for these 150 msec?  That's annoyingly long (and I
suspect in real Emacs usage will be significantly longer, due to
memory allocation, encoding, etc.).

Real usage with "xdisp.c":

    (define-advice tree-sitter--do-parse (:around (f &rest args) benchmark)
      (message "%s" (benchmark-run (apply f args))))

    (0.257998 1 0.13326100000000096)

So yes, direct access to buffer's text from dynamic modules would be nice.

--
Tuấn-Anh Nguyễn
Software Engineer


reply via email to

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