News for hackers. Stuff that matters.
Re:Emacs 27.2 by TeMPOraL on Thursday March 25, 2021 @11:56AM (#26581850)
Definitely go for GccEmacs (feature/native-comp) branch if you haven't yet. Despite being experimental, it's pretty much stable. I've been running it for over half a year as a daily driver, and seen zero issues (but much performance improvements!). Similar stories abound on-line.

Wish something be done about proper threading support, but I understand it's a herculean task at this point.

(For those unfamiliar, GccEmacs is a parallel branch of Emacs that uses libgccjit to compile ELisp straight to native code. It does it transparently - compiling in the background and then substituting bytecode-compiled functions for native-compiled.)

Re:Emacs 27.2 by chriswarbo on Thursday March 25, 2021 @12:32PM (#26582304)
> Wish something be done about proper threading support, but I understand it's a herculean task at this point.

I would agree about adding concurrency and parallelism; but threading is very much a WorseIsBetter approach, which I certainly wouldn't like to use directly.

Co-routines or futures would seem a better fit for Lispy semantics. Actors seem too different and heavyweight, but I'd still prefer them to threading!

Re:Emacs 27.2 by taeric on Thursday March 25, 2021 @01:34PM (#26583065)
I'm actually somewhat unclear in what the goals of threading are, at times. Pushing a process out and having a sentinel on a buffer has long been possible.

What is the aim?

Re:Emacs 27.2 by TeMPOraL on Thursday March 25, 2021 @06:47PM (#26586596)
Make it more light-weight and do it without needing a foreign binary. If your elisp program needs to offload some computations to a background thread, you don't want to make a binary specifically for it - it would destroy the flexibility and portability of otherwise perfectly fine elisp code.
Re:Emacs 27.2 by taeric on Thursday March 25, 2021 @08:41PM (#26587568)
I mean, I get this in principal. I'm curious in practice. How many things aren't already waiting on another foreign process that take time?

Edit: I could see some things like syntax highlighting being a benefit. Though, I somewhat expect those to already be moving to lsp tricks. Layout, in general, makes sense to be a bit more responsive. But I'm not clear how general threading helps with that.

Edit2: are there good benchmarks for emacs to look at and play with?

Re:Emacs 27.2 by TeMPOraL on Friday March 26, 2021 @05:30AM (#26590191)
The big things are indeed being outsourced to separate processes. LSP handles a lot, I also see some attempts at moving syntax highlighting to tree-sitter[0]. But all such work means a good chunk of code is running inside a foreign process, whose behavior cannot be easily inspected or modified at runtime.

But there are a lot of various smaller things in Emacs and elisp module ecosystem that would benefit from being able to run off the main thread. Emacs performance is fighting death by a thousand cuts, with almost everything being tied to the main thread (despite async features being used to pretend it's not).

--

[0] - https://tree-sitter.github.io/tree-sitter/

Re:Emacs 27.2 by taeric on Friday March 26, 2021 @11:12AM (#26593089)
The inspection and modification is a strong point that I should have considered.
Re:Emacs 27.2 by chriswarbo on Friday March 26, 2021 @05:25AM (#26590170)
I stopped using Gnus because its elisp freezes Emacs (I now use mu4e, which has a separate process).

I would guess Eww would have a similar issue, although I've never been able to get it to work (I use emacs-w3m, which has a separate process).

I've found some programming modes to be very slow and prone to freezing; most noticably Scala using Metals (which uses lsp).

Re:Emacs 27.2 by taeric on Friday March 26, 2021 @11:15AM (#26593126)
Do you know what makes it freeze? My gut would be that they did not set a buffer with a sentinel, such that even with threading, they would have still don't a blocking call there.

That said, valid points. I am curious to benchmark parts of emacs now. (I turned off most programming features, since most of my code is remote and the network at home kills me.)

Re:Emacs 27.2 by chriswarbo on Friday March 26, 2021 @04:54PM (#26596818)
> Do you know what makes it freeze?

For Gnus it was using the built-in fetchers like nnrss, which would block the Emacs process until downloads finished. Using a cron job to fetch RSS feeds avoided this, but it would still take a while to check for updates even from local files. This was around 2012, so Gnus might have improved since.

FYI my current setup is described at http://chriswarbo.net/blog/2017-01-14-rss_to_maildir.html

Re:Emacs 27.2 by hollerith on Friday March 26, 2021 @12:55PM (#26594311)
>you don't want to make a binary specifically for it

Most of the Emacs code I've seen that spawns a process spawns a short shell script: no custom binary needed.

Re:Emacs 27.2 by TeMPOraL on Thursday March 25, 2021 @06:49PM (#26586607)
I said "threading" as a catch-all term. Whatever makes Emacs able to fully utilize multiple cores of a CPU would work.
Re:Emacs 27.2 by chriswarbo on Friday March 26, 2021 @05:27AM (#26590180)
I get that; which is why I call out such things when I see them (I really hate threading!) ;)