From: Ihor Radchenko <yantar92@gmail.com>
To: 57197@debbugs.gnu.org
Subject: bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?
Date: Sun, 14 Aug 2022 12:18:52 +0800 [thread overview]
Message-ID: <875yiv1mqb.fsf@localhost> (raw)
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
next reply other threads:[~2022-08-14 4:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-14 4:18 Ihor Radchenko [this message]
2022-08-15 5:57 ` bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp? Akib Azmain Turja
2022-08-15 7:13 ` Lars Ingebrigtsen
2022-08-15 8:05 ` Ihor Radchenko
2022-08-15 9:43 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-15 11:46 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875yiv1mqb.fsf@localhost \
--to=yantar92@gmail.com \
--cc=57197@debbugs.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).