unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Akib Azmain Turja <akib@disroot.org>
To: yantar92@gmail.com, 57197@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	[thread overview]
Message-ID: <87a68659ro.fsf@disroot.org> (raw)
In-Reply-To: <875yiv1mqb.fsf@localhost>

[-- 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 --]

  reply	other threads:[~2022-08-15  5:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=87a68659ro.fsf@disroot.org \
    --to=akib@disroot.org \
    --cc=57197@debbugs.gnu.org \
    --cc=yantar92@gmail.com \
    /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).