* 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
* bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?
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
0 siblings, 2 replies; 6+ messages in thread
From: Akib Azmain Turja @ 2022-08-15 5:57 UTC (permalink / raw)
To: yantar92, 57197
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
> 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@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?
2022-08-15 5:57 ` Akib Azmain Turja
@ 2022-08-15 7:13 ` Lars Ingebrigtsen
2022-08-15 8:05 ` Ihor Radchenko
1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-15 7:13 UTC (permalink / raw)
To: Akib Azmain Turja; +Cc: yantar92, 57197
Akib Azmain Turja <akib@disroot.org> writes:
> I think the problem is the interpreter itself, which is not thread-safe.
Yes, the interpreter (byte-code or not) itself is not thread-safe, so I
don't think it's feasible to do anything here without a serious rewrite
of that.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?
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
1 sibling, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-08-15 8:05 UTC (permalink / raw)
To: Akib Azmain Turja; +Cc: 57197
Akib Azmain Turja <akib@disroot.org> writes:
> I think the problem is the interpreter itself, which is not
> thread-safe.
Thanks for the clarification! This is unfortunate.
> This looks like a feature request, I think emacs-devel is good for that.
I have heard on emacs-devel that M-x report-emacs-bug should also be
used for feature requests. Moreover, CONTRIBUTE says:
Bug reports and fixes, feature requests and patches/implementations
should be sent to bug-gnu-emacs@gnu.org, the bug/feature list. This
is coupled to the https://debbugs.gnu.org tracker. It is best to use
the command 'M-x report-emacs-bug RET' to report issues to the tracker
(described below). Be prepared to receive comments and requests for
changes in your patches, following your submission.
Let me know if I miss something.
--
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
* bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?
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
0 siblings, 1 reply; 6+ messages in thread
From: Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-15 9:43 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: 57197
[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]
Ihor Radchenko <yantar92@gmail.com> writes:
>> This looks like a feature request, I think emacs-devel is good for that.
>
> I have heard on emacs-devel that M-x report-emacs-bug should also be
> used for feature requests. Moreover, CONTRIBUTE says:
>
> Bug reports and fixes, feature requests and patches/implementations
> should be sent to bug-gnu-emacs@gnu.org, the bug/feature list. This
> is coupled to the https://debbugs.gnu.org tracker. It is best to use
> the command 'M-x report-emacs-bug RET' to report issues to the tracker
> (described below). Be prepared to receive comments and requests for
> changes in your patches, following your submission.
>
> Let me know if I miss something.
Maybe I'm wrong. But looks like discussion takes place mainly on
emacs-devel. Please correct me if I'm wrong.
--
Akib Azmain Turja
Find me on Mastodon at @akib@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#57197: 28.1.90; Can pure side-effect-free functions use multiple CPUs in Elisp?
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
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-08-15 11:46 UTC (permalink / raw)
To: Akib Azmain Turja; +Cc: yantar92, 57197
> Cc: 57197@debbugs.gnu.org
> Date: Mon, 15 Aug 2022 15:43:04 +0600
> From: Akib Azmain Turja via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> >> This looks like a feature request, I think emacs-devel is good for that.
> >
> > I have heard on emacs-devel that M-x report-emacs-bug should also be
> > used for feature requests. Moreover, CONTRIBUTE says:
> >
> > Bug reports and fixes, feature requests and patches/implementations
> > should be sent to bug-gnu-emacs@gnu.org, the bug/feature list. This
> > is coupled to the https://debbugs.gnu.org tracker. It is best to use
> > the command 'M-x report-emacs-bug RET' to report issues to the tracker
> > (described below). Be prepared to receive comments and requests for
> > changes in your patches, following your submission.
> >
> > Let me know if I miss something.
>
> Maybe I'm wrong. But looks like discussion takes place mainly on
> emacs-devel. Please correct me if I'm wrong.
You are both right.
Feature requests should in general be sent as bug reports. However,
if a feature request is likely to mean a major redesign of a large
part of Emacs, it is best first to discuss it on emacs-devel, so that
we could assess its feasibility with more hands on deck.
^ 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 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.