GNU bug report logs - #57197
28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> gmail.com>

Date: Sun, 14 Aug 2022 04:19:01 UTC

Severity: normal

Found in version 28.1.90

Full log


Message #8 received at 57197 <at> debbugs.gnu.org (full text, mbox):

From: Akib Azmain Turja <akib <at> disroot.org>
To: yantar92 <at> gmail.com, 57197 <at> debbugs.gnu.org
Subject: bug#57197: 28.1.90; Can pure side-effect-free functions use
 multiple CPUs in Elisp?
Date: Mon, 15 Aug 2022 11:57:31 +0600
[Message part 1 (text/plain, inline)]
> Hi,
> 
> The known blocker of Elisp support of multi-threading is shared Elisp
> machine state. Handling competing access to global Elisp variables is
> tricky. However, it is not the case for pure side-effect-free functions.
> 
> Consider the following code:
> 
> (let (long-list-of-cons)
>   (dotimes (i 100000)
>     (push (cons i (1+ i)) long-list-of-cons))
>   (mapcar #'car long-list-of-cons))
> 
> The last mapcar looks like a good candidate to run on multiple CPUs.
> I imagine that instead of applying #'car sequentially, Elisp can split
> the list in chunks and run them independently on multiple CPUs. This
> operation is still blocking and thus will not create issues with shared
> access. At the same time such mapcar call will finish much faster.
> 
> Would something like this be feasible to implement in Elisp?
> 
> -- 
> Ihor Radchenko,
> Org mode contributor,
> Learn more about Org mode at https://orgmode.org/.
> Support Org development at https://liberapay.com/org-mode,
> or support my work at https://liberapay.com/yantar92
>

I think the problem is the interpreter itself, which is not thread-safe.
This looks like a feature request, I think emacs-devel is good for that.

-- 
Akib Azmain Turja

Find me on Mastodon at @akib <at> hostux.social.

This message is signed by me with my GnuPG key.  Its fingerprint is:

    7001 8CE5 819F 17A3 BBA6  66AF E74F 0EFA 922A E7F5
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 2 years and 309 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.