unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?
@ 2022-08-14  4:18 Ihor Radchenko
  2022-08-15  5:57 ` Akib Azmain Turja
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-08-14  4:18 UTC (permalink / raw)
  To: 57197

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-15 11:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-14  4:18 bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp? Ihor Radchenko
2022-08-15  5:57 ` 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

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).