all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Wiegley <johnw@newartisans.com>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: async 1.0
Date: Fri, 22 Jun 2012 16:39:23 -0500	[thread overview]
Message-ID: <m2vcij3u2c.fsf@newartisans.com> (raw)
In-Reply-To: <E1Si2Bi-0007sa-9y@fencepost.gnu.org> (Richard Stallman's message of "Fri, 22 Jun 2012 07:38:06 -0400")

>>>>> Richard Stallman <rms@gnu.org> 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



  reply	other threads:[~2012-06-22 21:39 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2hau86tfk.fsf@vulcan.local.i-did-not-set--mail-host-address--so-tickle-me>
     [not found] ` <E1ShM8F-0006IY-L9@fencepost.gnu.org>
     [not found]   ` <m2txy51z1k.fsf@newartisans.com>
     [not found]     ` <E1ShiKM-0000Aa-5G@fencepost.gnu.org>
2012-06-21 21:23       ` async 1.0 John Wiegley
2012-06-22  7:00         ` Teemu Likonen
2012-06-22 10:54           ` John Wiegley
2012-06-22 12:39             ` Michael Albinus
2012-06-22 22:02               ` John Wiegley
2012-07-04 17:10                 ` Samuel Bronson
2012-07-05  4:09                   ` John Wiegley
2012-07-05 19:58                     ` Samuel Bronson
     [not found]             ` <82d34r8ej9.fsf@gmail.com>
2012-06-22 21:50               ` John Wiegley
2012-06-23  1:44                 ` Stefan Monnier
2012-06-23  3:00                 ` Stefan Monnier
2012-06-23 16:26                   ` Lennart Borgman
2012-06-23 21:08                   ` John Wiegley
2012-06-23 21:28                     ` Jeremiah Dodds
2012-06-23 21:50                     ` Thierry Volpiatto
2012-06-24 15:02                     ` Christopher Schmidt
2012-06-24 15:42                       ` Bastien
2012-06-24 21:01                       ` John Wiegley
2012-06-25 14:53                         ` Christopher Schmidt
2012-06-25 23:54                           ` John Wiegley
2012-06-24 21:12                       ` ELPA and core services John Wiegley
2012-06-24 21:40                         ` Lennart Borgman
2012-06-25  2:20                         ` Stefan Monnier
2012-06-25  4:39                         ` Stephen J. Turnbull
2012-06-25  6:01                         ` Achim Gratz
2012-07-03 14:38                           ` Tom Tromey
2013-01-22 19:13                             ` Achim Gratz
2012-06-25  4:32                       ` stdlib for Emacs? [was: async 1.0] Stephen J. Turnbull
2012-06-23  6:25                 ` async 1.0 Stephen J. Turnbull
2012-06-23 21:05                   ` John Wiegley
2012-07-01  8:16                   ` Michael Sperber
2012-06-22 11:38         ` Richard Stallman
2012-06-22 21:39           ` John Wiegley [this message]
2012-06-22 23:02             ` Richard Stallman
2012-06-23  7:46               ` zwz
2012-06-23 20:49                 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2vcij3u2c.fsf@newartisans.com \
    --to=johnw@newartisans.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.