Subject: Re: bug#65760: 29.1; eglot performance issue

From: Eli Zaretskii <[email-masked]>
Date: Tue, 05 Sep 2023 19:22:15 +0300

> Cc: [email-masked]
> From: Ivan Sokolov <[email-masked]>
> Date: Tue, 05 Sep 2023 18:55:23 +0300
> 
> Глеб Смирнов <[email-masked]> writes:
> 
> > The problem is that running eglot with rust-analyzer on my project
> > causes major input lag. Profiling shows that the problem is in
> > synchronous and slow function jsonrpc--log-event that is called on each
> > server request or response. Disabling this function with (advice-add
> > 'jsonrpc--log-event :override #'ignore) solves the problem.
> 
> To be more precise the problem is that jsonrpc--log-event is pretty
> printing every reply from the server and they can be quite large and
> nested.  I am attaching Gleb's profiler report, as a screenshot, but
> this should be enough to give a better understanding of the problem.

Yes, the real CPU eater is pp-buffer.

But I also see that jsonrpc-request took a substantial amount of CPU
time, and since jsonrpc-request runs from a timer, it is a good
candidate for explaining a perceived lag.

Can you tell if this profile was in an Emacs build with built-in JSON
support, or was Emacs using the Lisp implementation on json.el?