unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: glebsmirnov0708@gmail.com, joaotavora@gmail.com, 65760@debbugs.gnu.org
Subject: bug#65760: 29.1; eglot performance issue
Date: Tue, 05 Sep 2023 20:20:50 +0300	[thread overview]
Message-ID: <875y4o5yfh.fsf@ya.ru> (raw)
In-Reply-To: <837cp44mko.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 05 Sep 2023 19:22:15 +0300")

[-- Attachment #1: Type: text/plain, Size: 1915 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

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


[-- Attachment #2: profiler report with advice --]
[-- Type: image/jpeg, Size: 70661 bytes --]

      parent reply	other threads:[~2023-09-05 17:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05  9:01 bug#65760: 29.1; eglot performance issue Глеб Смирнов
2023-09-05 15:55 ` Ivan Sokolov
2023-09-05 16:22   ` Eli Zaretskii
2023-09-05 16:25     ` Eli Zaretskii
2023-09-05 16:45       ` João Távora
2023-09-05 16:59       ` Axel Forsman
2023-09-05 17:11         ` João Távora
2023-09-05 17:20     ` Ivan Sokolov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875y4o5yfh.fsf@ya.ru \
    --to=ivan-p-sokolov@ya.ru \
    --cc=65760@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=glebsmirnov0708@gmail.com \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).