GNU bug report logs - #65760
29.1; eglot performance issue

Previous Next

Package: emacs;

Reported by: Глеб Смирнов <glebsmirnov0708 <at> gmail.com>

Date: Tue, 5 Sep 2023 15:25:01 UTC

Severity: normal

Found in version 29.1

Full log


Message #26 received at 65760 <at> debbugs.gnu.org (full text, mbox):

From: Ivan Sokolov <ivan-p-sokolov <at> ya.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: glebsmirnov0708 <at> gmail.com, joaotavora <at> gmail.com, 65760 <at> debbugs.gnu.org
Subject: Re: bug#65760: 29.1; eglot performance issue
Date: Tue, 05 Sep 2023 20:20:50 +0300
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 65760 <at> debbugs.gnu.org
>> From: Ivan Sokolov <ivan-p-sokolov <at> ya.ru>
>> Date: Tue, 05 Sep 2023 18:55:23 +0300
>> 
>> Глеб Смирнов <glebsmirnov0708 <at> gmail.com> 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.

Before disabling jsonrpc--log-event, it accounted for most of the
execution time of jsonrpc-request.  After disabling jsonrpc--log-event
jsonrpc-request took much less CPU, on par with command-execute, see the
attachment.

> 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?

I think JSON in the list below signifies built-in JSON support:

Глеб Смирнов <glebsmirnov0708 <at> gmail.com> writes:

> Configured features:
> CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
> LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
> PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
> TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB

[jsonrpc--log-event-profiler-with-advice.jpg (image/jpeg, attachment)]

This bug report was last modified 1 year and 340 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.