unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: yyoncho <yyoncho@gmail.com>
To: monnier@iro.umontreal.ca
Cc: emacs-devel@gnu.org
Subject: Re: Running process filters in another thread
Date: Sun, 30 Sep 2018 10:08:06 +0300	[thread overview]
Message-ID: <CACCVLQV=NWm7RH5f2cABOtdmFQ+df199aXahbGrcoROAcS2Lgg@mail.gmail.com> (raw)
In-Reply-To: <jwvpnwwukyl.fsf-monnier+emacs@gnu.org>

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

Hi Stefan,

> So, IIUC the scenario is that the LSP sends us large JSON data
> structures, but we only ever use a fairly small portion of it, so
> presumably a significant part of the total processing time is spent
> gobbling data and parsing it into an internal data structure.

AFAIK this is not the case, LSP is pretty minimal. This could be true for
some
limited cases but in general we need all of the data.

> Beside limiting the total amount of time spent doing this (e.g. by
> processing the data more efficiently (e.g. in C rather in Elisp) or in
> parallel), the other issue is the fact that it shouldn't cause pauses in
> the user interaction.  This can be obtained via true concurrency, or by
> slicing the processing so it can be interleaved finely with user
> interaction without any noticeable pauses.

> Maybe an "easy" way to solve this particular problem is to define the
> json parser as a "yield point".  This would even allow the
> implementation of the json parser to spawn a separate thread and do the
> parsing in a truly concurrent thread (tho the GC would need to be
> extended to be able to deal with such truly concurrent non-Elisp
> threads allocating Elisp data structures, maybe this can be done by
> making those json threads use their own Elisp heap which gets joined
> into the main heap at the end).

Yeah, that is what I was looking for. I believe it will be a big
improvement from
UX standpoint of view. Also, it seems like if we have that kind of
infrastructure inplace this will open many other options.

> IIUC eglot does use the native json parser.  BTW, I'd be happy to hear
> about the use of jsonrpc.el in lsp-mode (either failures or successes)
> and more generally consolidation of effort between eglot and lsp-mode.

I would like to see consolidation too. I will file a task for investigating
jsonrpc.el.

Thanks,
Ivan


On Sat, Sep 29, 2018 at 11:30 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > Some of the responses/notifications might be big e. g.
> > 1. Diagnostics
> > 2. Semantic highlight data(proportional to file size)
>
> So, IIUC the scenario is that the LSP sends us large JSON data
> structures, but we only ever use a fairly small portion of it, so
> presumably a significant part of the total processing time is spent
> gobbling data and parsing it into an internal data structure.
>
> Beside limiting the total amount of time spent doing this (e.g. by
> processing the data more efficiently (e.g. in C rather in Elisp) or in
> parallel), the other issue is the fact that it shouldn't cause pauses in
> the user interaction.  This can be obtained via true concurrency, or by
> slicing the processing so it can be interleaved finely with user
> interaction without any noticeable pauses.
>
> Maybe an "easy" way to solve this particular problem is to define the
> json parser as a "yield point".  This would even allow the
> implementation of the json parser to spawn a separate thread and do the
> parsing in a truly concurrent thread (tho the GC would need to be
> extended to be able to deal with such truly concurrent non-Elisp
> threads allocating Elisp data structures, maybe this can be done by
> making those json threads use their own Elisp heap which gets joined
> into the main heap at the end).
>
> > a filter to that pipeline won't be a problem. One we (lsp-mode
> > contributors) move it to native json I will resume the discussion if
> > with some concrete testing data.
>
> IIUC eglot does use the native json parser.  BTW, I'd be happy to hear
> about the use of jsonrpc.el in lsp-mode (either failures or successes)
> and more generally consolidation of effort between eglot and lsp-mode.
>
>
>         Stefan
>

[-- Attachment #2: Type: text/html, Size: 4736 bytes --]

  reply	other threads:[~2018-09-30  7:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28 18:21 Running process filters in another thread yyoncho
2018-09-28 21:14 ` Eli Zaretskii
     [not found]   ` <CACCVLQUrpxuhKwaHbFfCSzYLfucL8x+tJOkwgKwK8bzb0VZaWg@mail.gmail.com>
2018-09-29  6:54     ` Fwd: " yyoncho
2018-09-29  7:37       ` Eli Zaretskii
2018-09-28 23:03 ` Stefan Monnier
2018-09-29  7:35   ` yyoncho
2018-09-29  8:15     ` Eli Zaretskii
2018-09-29 18:10     ` Stefan Monnier
2018-09-29 19:23       ` yyoncho
2018-09-29 20:30         ` Stefan Monnier
2018-09-30  7:08           ` yyoncho [this message]
2018-09-30 13:01             ` Stefan Monnier
2018-09-30 15:01               ` yyoncho
2018-10-01 21:12 ` Tom Tromey

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='CACCVLQV=NWm7RH5f2cABOtdmFQ+df199aXahbGrcoROAcS2Lgg@mail.gmail.com' \
    --to=yyoncho@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).