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: Fri, 22 Jun 2012 16:39:23 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1340401176 24164 80.91.229.3 (22 Jun 2012 21:39:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 22 Jun 2012 21:39:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 22 23:39:36 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 1SiBZn-0002Bv-SM for ged-emacs-devel@m.gmane.org; Fri, 22 Jun 2012 23:39:35 +0200 Original-Received: from localhost ([::1]:55034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiBZn-0001Pt-TX for ged-emacs-devel@m.gmane.org; Fri, 22 Jun 2012 17:39:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiBZk-0001Pb-O5 for emacs-devel@gnu.org; Fri, 22 Jun 2012 17:39:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiBZi-0003Le-1A for emacs-devel@gnu.org; Fri, 22 Jun 2012 17:39:32 -0400 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:41198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiBZh-0003L3-R2; Fri, 22 Jun 2012 17:39:29 -0400 Original-Received: by yenr5 with SMTP id r5so2414391yen.0 for ; Fri, 22 Jun 2012 14:39:26 -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=fBst9k2/1OwxDb0DCarEh+QouYkf8NzlYQSovk+e1H8=; b=wlBeg2ey5wmhs8mmz9rb0lALvcNsG/703QElmpxS4hY3YcbkaRtSBrpdXmejiHhHFD WIo+CVnDVqUHWGzrDRczDgf9aS9e3cxXYT2wAyAQoN+nnDAg8X/3eysprd+xyDZEU5bx UgP1Vn3nFGSaRcue7lGFkqTaJY3JUylp5KtoOSNqkM2oNmBd5DAK/URrEQiQjc9lEmhw V2K/Ip421m9HyZjZfFEUY1I2Iszyiv3yRl8QurxyVK6znR0wBLz8WAbcxL8weMo+vMuL cPzWhhCUJ34oz97Utl3+gLMYsrnjflm79C7K2xkc6zDsp01hm+sx7kcRXFf7SZ7tscPt OOAQ== Original-Received: by 10.50.190.230 with SMTP id gt6mr2933380igc.48.1340401166186; Fri, 22 Jun 2012 14:39:26 -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 uy3sm165625igc.14.2012.06.22.14.39.24 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 14:39:25 -0700 (PDT) Original-Received: by vulcan.local (Postfix, from userid 501) id 3385EF0411A4; Fri, 22 Jun 2012 16:39:23 -0500 (CDT) Mail-Followup-To: rms@gnu.org, emacs-devel@gnu.org In-Reply-To: (Richard Stallman's message of "Fri, 22 Jun 2012 07:38:06 -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.213.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:151092 Archived-At: >>>>> Richard Stallman writes: > I didn't realize it could be so fast. On my machine, emacs -Q -batch --eval > "(+ 10 20)" takes about 1/4 second. What kind of hardware are you using? The Emacs that I'm running in off an SSD with a lot of cache RAM available. If I do it on my laptop, which also has an SSD, I get the same times: 0.03713s. I've also found another use for async.el: sandboxing. The following allows me execute a lambda synchronously, but without affecting the host Emacs environment: (async-get (async-start FUNC)) I see this idiom being useful enough that I've reduced it to one function, (async-sandbox FUNC). Here's an example of using sandboxing to byte-compile a file, without letting `eval-when-compile' forms affect the host environment: (let ((proc (async-start `(lambda () (require 'bytecomp) ,(async-inject-variables "\\`load-path\\'") (let ((default-directory ,(file-name-directory file))) (add-to-list 'load-path default-directory) (ignore-errors (load ,file)) ;; returns nil if there were any errors (prog1 (byte-compile-file ,file) (load ,file))))))) (unless (condition-case err (async-get proc) (error (ignore (message "Error: %s" err)))) (ignore (message "Recompiling %s...FAILED" file)))) John