bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPU


From: Ihor Radchenko
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

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]