From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: async 1.0 Date: Thu, 21 Jun 2012 16:23:26 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1340313822 3741 80.91.229.3 (21 Jun 2012 21:23:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 21 Jun 2012 21:23:42 +0000 (UTC) Cc: Emacs developers To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 21 23:23:40 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Shoqm-0004sJ-N1 for ged-emacs-devel@m.gmane.org; Thu, 21 Jun 2012 23:23:36 +0200 Original-Received: from localhost ([::1]:50586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Shoqm-0004mg-MR for ged-emacs-devel@m.gmane.org; Thu, 21 Jun 2012 17:23:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Shoqj-0004mL-RJ for emacs-devel@gnu.org; Thu, 21 Jun 2012 17:23:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Shoqi-0000Mg-5A for emacs-devel@gnu.org; Thu, 21 Jun 2012 17:23:33 -0400 Original-Received: from mail-gg0-f169.google.com ([209.85.161.169]:50958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Shoqh-0000Mb-V1; Thu, 21 Jun 2012 17:23:32 -0400 Original-Received: by ggm4 with SMTP id 4so1256153ggm.0 for ; Thu, 21 Jun 2012 14:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:mail-followup-to:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=1gmTngxB4/ZgonRKoFcPtb2HMBQgbutdQ7NoS9V+5QE=; b=0q4WPQBu/OQevpSuFuPkmUJG8mhSag0hXcg5GsbOeLdGIfxojASPXhdjxOFe/jiH5o a5vWQXuDyPPGzBUXD855FLRZaoW7it0adENdVaS7VsFeB9JBdShI83VJtyIa0lA5rgTL jfIqSg3zeqv3nucSxQ7qXNfFPktSzv3s/8Za+Y3QStk2m9Ip6ox6afhgvprFXHjdRK7m 8JAbADrtwffgKkUItaj0m+zyVvT0b1WMzlqmvbxC+cXGqxm3mtgcLerJpDJT69Rq+nIo WGpjVSe3s5CvxsJ9+MzABbUFdUDFrJCRyWXPDGeQUldjl3SHCRPi/K+unaYV/W93G17E tJUA== Original-Received: by 10.50.183.200 with SMTP id eo8mr9060022igc.63.1340313808404; Thu, 21 Jun 2012 14:23:28 -0700 (PDT) Original-Received: from vulcan.local (c-98-215-105-167.hsd1.il.comcast.net. [98.215.105.167]) by mx.google.com with ESMTPS id nh1sm19017413igc.11.2012.06.21.14.23.27 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jun 2012 14:23:27 -0700 (PDT) Original-Received: by vulcan.local (Postfix, from userid 501) id B58F9EFDF326; Thu, 21 Jun 2012 16:23:26 -0500 (CDT) Mail-Followup-To: rms@gnu.org, Emacs developers In-Reply-To: (Richard Stallman's message of "Thu, 21 Jun 2012 10:25:42 -0400") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (darwin) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.161.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151075 Archived-At: >>>>> Richard Stallman writes: > async.el uses `start-process' to spawn a child Emacs process for the > purpose of invoking the lambda that is passed as the first argument to > `async-start'. > I see it would work, but wouldn't it be horribly slow to start up? You know, Emacs is suprisingly fast to execute if you use "emacs -batch -Q". For example: vulcan ~ $ average -n 100 emacs -Q -batch --eval "(+ 10 20)" 0.0393513631821 It's only 39.4ms overhead per invocation to use Emacs this way -- plus the time required load modules used by the async process, and injection of the variable environment. For example: vulcan ~ $ average -n 100 emacs -Q -batch \ --eval "(progn (require 'smtpmail) (+ 10 20))" 0.143285052776 Now we're up to 143ms. What makes this OK is that the job I'm asking `async-start' to do takes many seconds, such that the overhead of starting a new Emacs interpreter is completely lost in the time required to do the work -- time otherwise spent with me staring at a wait cursor. As a further example: In Gnus, hitting M-g on the emacs-devel group takes around 60s (I have a lot of back articles). If async.el were integrated, this operation would return instantly, with some kind of fontification to show the group being updated in the background, and blocking behavior if I hit RET to actually visit the group before it's done. That's kind of how dired-async.el operates now: When you copy a bunch of large files, control returns to you immediately, and each file is colorized with a yellow background that gets removed once that copy operation is completed. John