Subject: bug#38807: [Feature request]: Support lisp workers like web workers.

From: HaiJun Zhang <[email-masked]>
Date: Tue, 24 Mar 2020 12:22:57 +0800

在 2020年3月22日 +0800 PM10:32，Eli Zaretskii <[email-masked]>，写道：
>
> Suppose a module thread will be able to parse JSON: what would the
> main (a.k.a. "Lisp") thread of Emacs do while the module thread is
> working? Doesn’t it need to wait for the parsed data anyhow?
>

They don’t known each other. It will be good if module thread can post message to lisp thread. It will be better if module thread can send lisp data within the message to lisp thread.

>
> > If json messages are parsed in module thread and saved as c struct data(not lisp data), they have to be
> > translated to lisp data before emacs use. The translation which should be done in emacs thread cost too
> > much cpu, which make the parallel parsing of json messages not very useful.
>
> You are saying that the translation is costly, but did someone
> actually measure that and verify that it's indeed costly? And if
> someone did, where can I see the results in sufficient level of detail
> to understand what part(s) of parsing JSON are the bottleneck?
>

I have talked with the author of lsp-mode. I think their team have done some work on this.
@yyoncho Can you join the discussion?

> > Is it possible to parse json messages and prepare data struct for pdumper, and translate the data to lisp
> > using pdumper? What about the performanse comparing with the above?
>
> I don't think I understand what does pdumper have to do with this
> issue.

My understanding is that pdumper can serialize and deserialize lisp data. Maybe we can prepare data with its format and let it deserialize them.