From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: yyoncho Newsgroups: gmane.emacs.bugs Subject: bug#42028: [Feature Request] 27.0.91; Provide the ability dynamic modules to post events in emacs event loop Date: Wed, 24 Jun 2020 19:46:56 +0300 Message-ID: References: <875zbh0wbf.fsf@gmail.com> <83bll8ttet.fsf@gnu.org> <83366ktol5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fee45f05a8d73915" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="67615"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42028@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 24 19:14:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jo8yP-000HSk-8S for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Jun 2020 19:14:09 +0200 Original-Received: from localhost ([::1]:43102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jo8yO-0006FV-5t for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Jun 2020 13:14:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jo8Z8-0002SU-Cq for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2020 12:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55475) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jo8Z8-0007JM-23 for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2020 12:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jo8Z7-0007pV-Vm for bug-gnu-emacs@gnu.org; Wed, 24 Jun 2020 12:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: yyoncho Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Jun 2020 16:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42028 X-GNU-PR-Package: emacs Original-Received: via spool by 42028-submit@debbugs.gnu.org id=B42028.159301723830044 (code B ref 42028); Wed, 24 Jun 2020 16:48:01 +0000 Original-Received: (at 42028) by debbugs.gnu.org; 24 Jun 2020 16:47:18 +0000 Original-Received: from localhost ([127.0.0.1]:38788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jo8YP-0007oV-PM for submit@debbugs.gnu.org; Wed, 24 Jun 2020 12:47:18 -0400 Original-Received: from mail-lf1-f54.google.com ([209.85.167.54]:37642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jo8YM-0007oF-4k for 42028@debbugs.gnu.org; Wed, 24 Jun 2020 12:47:16 -0400 Original-Received: by mail-lf1-f54.google.com with SMTP id k15so1643547lfc.4 for <42028@debbugs.gnu.org>; Wed, 24 Jun 2020 09:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Fwn0feY9rnR09OVuwGU1IxdGW+SezzB11Ycrrn+sxDI=; b=XCb0m8pkxrr+85xd656oX66f7xiyttp/JFFKJV/GdK/zH5EnsMAXfWvQ4I/mDKIN6U HJqGfu1s6D4VubrqZ4xRdrAbLJqHhLsmUZtuRhCL5nkSJcdSnkbpGzatCuEh4KIlJNLS ddmLfDb0ywARHKvIiuBnRxGzUblBJz6+bZ/tLSUBxCyv2D2QY0Pz7+pkO305Nk6T4+// Tc02wyiILGFJB+cLEpywsiuAaaIznMgFiLFZmQ0KIpYsKtuBYsSZQtQzk2mpwJBSm5vM FpawkkjzC1+uKDJBWmiDYDp5D2RZREgTj8OmFM5FHwe98/m4Eh7Z7EiioQWH9+ceQjU7 x74g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Fwn0feY9rnR09OVuwGU1IxdGW+SezzB11Ycrrn+sxDI=; b=O8x7oN4C3JjkTn3KAf/6EZRJooM8imWgx+TvT5V6l4lToxOjM7N0ttyCEoq7KRmZ11 yIT269tnu4YOdu8GmKQ6yiXvLRdwGztiTibXur6WDdjyRvU9ohNZSifEFQPMO9w3ubX5 WfdMN0D9v0XoQsxSMiIQIeS5Rg0IOeZ42UEJF2yMwVxtp0nJMzifhvPKdHtXkCpnPWm3 UGu4M1xUktkDNqJATk/cdZnBh36AuSY9zRZakWwBL6kDs1u4EQPzQCcOBm7If8zbUvIw /KQfUrNBM0so7EAG+3oCzUXBZgL+E/YvVhKQ2ntMTXCsJukVY6Y9I9UHH+4k0dvmalTE j77w== X-Gm-Message-State: AOAM530t5LpgaRL5pzpvH6XSQKZQUIrSfxbMVVpyPpJzp66zDs6Nv27w Lk/ysCZ8Uc7lrXt2CUcghvO0quhu//9/EYPiYvSm6Q== X-Google-Smtp-Source: ABdhPJywlJSeTUOfAxdhsGFiHoc+cxYYXCgAYcDKZiE7G34nb1yw4gaiKqiv7ixoVzP5yd9bupf6HQ/0cugOgqn7Cn0= X-Received: by 2002:a05:6512:303:: with SMTP id t3mr15948307lfp.159.1593017227992; Wed, 24 Jun 2020 09:47:07 -0700 (PDT) In-Reply-To: <83366ktol5.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:182346 Archived-At: --000000000000fee45f05a8d73915 Content-Type: text/plain; charset="UTF-8" Here it is an example: If we oversimplify json parsing consist of 2 parts. 1. JSON parsing to Jansson data structures 2. Converting Jasson data structures to lisp data structures. If we assume that 1 is taking most of the time then we could write the following code: start(string, callback) -> convert string to char* -> post it to worker thread -> worker thread does the parsing -> worker thread post to main loop -> main loop converts Jansson ds to lisp ds -> main loop calls the callback passed on start The same strategy probably could be applied to Font locking with TreeSitter. Thanks, Ivan On Wed, Jun 24, 2020 at 7:29 PM Eli Zaretskii wrote: > > From: yyoncho > > Date: Wed, 24 Jun 2020 19:17:30 +0300 > > Cc: 42028@debbugs.gnu.org > > > > As a side note, this feature will be useful even for the core C part for > anything > > that wants to perform async processing not including LispObject. > > How will it help that? The event queue is processed synchronously. > --000000000000fee45f05a8d73915 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here it is an example: If we oversimplify json parsing con= sist of 2 parts.

1. JSON parsing to Jansson data structures
2. Converting Jasson data structures to lisp data structures.
=

If we assume that 1 is taking most of the time then we = could write the following code:

start(string, call= back) -> convert string to char* -> post it to worker thread -> wo= rker thread does the parsing=C2=A0
-> worker thread post to ma= in loop -> main loop converts Jansson ds to lisp ds -> main loop
calls the callback passed on start

The same = strategy probably could be applied to Font locking with TreeSitter.=C2=A0

Thanks,
Ivan

On Wed, Jun 24, 2= 020 at 7:29 PM Eli Zaretskii <eliz@gnu.o= rg> wrote:
yyoncho@gmail.com>
> Date: Wed, 24 Jun 2020 19:17:30 +0300
> Cc: 42028@d= ebbugs.gnu.org
>
> As a side note, this feature will be useful even for the core C part f= or anything
> that wants to perform async processing not including LispObject.

How will it help that?=C2=A0 The event queue is processed synchronously.
--000000000000fee45f05a8d73915--