From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud Newsgroups: gmane.emacs.devel Subject: Re: async Gnus Date: Wed, 26 Jan 2022 11:05:43 +0100 Message-ID: <87wnimn760.fsf@elite.giraud> References: <87a6flqddp.fsf@elite.giraud> <87fspbzpu5.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2073"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix) Cc: emacs-devel@gnu.org To: Eric Abrahamsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 26 11:07:59 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nCfDa-0000Jk-RK for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jan 2022 11:07:58 +0100 Original-Received: from localhost ([::1]:44488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCfDZ-0002fx-9D for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jan 2022 05:07:57 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCfBg-0001XB-Rz for emacs-devel@gnu.org; Wed, 26 Jan 2022 05:06:00 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]:6045) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCfBe-0006QM-4i for emacs-devel@gnu.org; Wed, 26 Jan 2022 05:06:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=vQqVnJ204FGwEpkh b43QsdMh4A0hxGN0y4CVtlTpiUY=; h=in-reply-to:date:references:subject: cc:to:from; d=ledu-giraud.fr; b=nFFELq1p398na5A0j+On0mCBzwGGzrAs3gt1Ca 7k4pcHH61SLaF5f9iGPTmErPjcLkkNnFMJIQHS4AG072iAUz8k/qT2a23RnMnyvYKARqNY 3xdj3SxT3yfHwxF0E+86Ygs1C0VM39VCpSQH5Hb9GyB0R0yp0U8CesFSUsJYhV/xR+fZYc x8dmDkqv5m7546clCiLusFJQEHm4y6WJw1Vm1Dp43QIvMJoF1wfAIBdFd3ufpwh56am89l Lo2ca69BeSHxB5SPBXIdIPE9aT/EPCYuPxa7XibfjlHeeIO6ixAGCp6xhgvXmhANfCz0WD rBPS6AG+EnqmN9c5P+BRP6vA== Original-Received: from elite.giraud ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 0a1be8fc (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 26 Jan 2022 11:05:44 +0100 (CET) In-Reply-To: <87fspbzpu5.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 25 Jan 2022 09:29:22 -0800") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:285417 Archived-At: Eric Abrahamsen writes: > Manuel Giraud writes: > >> Hi, Hi Eric, >> I'd like to have Gnus being able to fetch some mails (and news >> obviously ;-) without freezing emacs completely. I'm currently >> trying the attached dumb patch that so far seems to fly with a gnus >> demon handler like this: >> >> (gnus-demon-add-handler 'gnus-group-get-new-news 5 nil) >> >> My questions are: >> >> - Is this the right place to discuss Gnus dev? > > Yes! Good! >> - This patch seems too simple: what am I missing? > > It's hard to say -- no one seems to know what to expect with threads. > The main issue I can see with your code is that it only uses a single > thread, which should mean (I haven't tested it) that it provides very > little speedup. All elisp execution happens in the main thread, the only > concurrency happens with network and process communication (maybe some > other stuff), so unless you're "layering" multiple process calls in > multiple threads, everything's going to happen more or less > consecutively anyway. I think you'd need one thread per Gnus server, so > that multiple connections to external servers (IMAP or NNTP or POP) > could do their thing concurrently. > > All this is just my theoretical understanding of how threads work, mind > you. Have you seen a significant speedup with this patch? I'm not looking for speedup I'm looking for being able to use Emacs as usual while Gnus is fetching stuff. But you are right that this patch does not achieve this: Emacs is still freezing from time to time and so it is not really better than the default Gnus demon behaviour. I'm suprprise: I thought that `make-thread' create a proper system thread. I'm digging into Gnus sources and also conclude that those threads should appear at a deeper layer (maybe at the method request layer or per Gnus server as you said). It would also permit concurrency between methods (or servers). I should also keep in mind that this could fallback to a non-threaded method for arch that do not have them. > Also, bug#49065 might have some relevant code you could refer to, I > think the author was trying to do something similar there. Thanks, I'll have a look at it! -- Manuel Giraud