Live data from Hacker News

I built a GPU back end for Emacs

en.andros.dev

101–110 of 117 posts

Re: I built a GPU back end for Emacs

#101
post #8

https://github.com/tanrax/emacs-gpu/blob/main/.github/assets... This massive speed-up on 4K screens makes me want to try it. The wayland pgtk version has such terrible latency I have to use the X11 build to avoid gnashing teeth during my working hours. And I think it's the X11 version that uses cairo, so the actual speedup in my case might be even larger. I reported the issue years ago, the pgtk maintainer confirmed,…

Just switch to xlibre.

Wayland is a dead end.

Re: I built a GPU back end for Emacs

#102
post #42

Emacs user for >32 years now. It's a pity this won't get merged. There is a big usability/accessibility factor to consider here: I really wish I could have something like the Ghostty cursor_blaze.glsl shader for highlighting where the cursor is when you switch windows/buffers/apps. Most people think GPU equals silly toys like video in a text window, but there is much more to it than that. [and yes, I know about beaco…

The feature is LLM generated, and also doesn’t bring any speed ups, only slowdowns

Re: I built a GPU back end for Emacs

#103
post #86
post #8

https://github.com/tanrax/emacs-gpu/blob/main/.github/assets... This massive speed-up on 4K screens makes me want to try it. The wayland pgtk version has such terrible latency I have to use the X11 build to avoid gnashing teeth during my working hours. And I think it's the X11 version that uses cairo, so the actual speedup in my case might be even larger. I reported the issue years ago, the pgtk maintainer confirmed,…

My experience with Emacs, 4K and Wayland was so abysmal that I spent a weekend making my config fully compatible with a terminal. Not ideal, but I'll keep running it through Ghostty until it's fixed.

I have been using only 4k monitors in Linux, with X11 (and XFCE) for more than a decade.

During the years, I have used a great number of text editors, e.g. vim, jedit, kate, geany, Visual Studio Code, neovim, etc.

Only this year I have switched to emacs, because it is more suitable for certain customizations that I prefer (for scripting, I like more Emacs Lisp than alternatives like Lua).

I have seen no performance problems (in GUI mode, I do not use it under a terminal emulator). On my hardware (with NVIDIA GPU) it is at least as fast as any other text editor that I had been using. Certainly much faster than Visual Studio Code.

As a terminal emulator I am now using ghostty, after previously using kitty and many other terminal emulators more distantly in the past, so GUI performance is important for me.

Ghostty seems faster than Emacs, so I believe that switching to GPU text rendering could accelerate Emacs, but for a significant speedup a more complete redesign of the graphics output would be necessary than in the parent article.

The problem is that this might be easy only when targeting a single GUI environment, but that would be in contradiction with the original Emacs goal, to be usable under many operating systems and GUI environments.

Re: I built a GPU back end for Emacs

#104

could've guessed staying away from xdisp.c was a good idea, cf. the "Buttery Smooth Emacs"[0] post: > Keep in mind that Emacs xdisp.c tries to support five different toolkits (including two different major versions of GTK) with #ifdefs. There is no runtime abstraction. We define three or four different versions of each damn function. It’s a nightmare. [0] https://gist.github.com/ghosty141/c93f21d6cd476417d4a9814eb7..…

"No runtime abstraction" seems the correct approach for good performance.

Run-time abstractions should always be avoided when the problem can be solved at compile-time.

While the conditional compilation syntax of the C/C++ preprocessor is not nice, good programming text editors can make it much more readable, by highlighting/hiding appropriate text sections.

Re: I built a GPU back end for Emacs

#105
post #10

Well done. Here’s hoping that a hand-written GPU backend gets developed based on this wonderful proof of concept. There’s no reason to not take advantage of the state of the art hardware when it’s available. And screens are only moving toward 4k and higher (6k or 8k).

Or that GNU updates a policy that will very rapidly go from probably net silly/mildly contestedly useful to completely ridiculous in a year or two. Not allowing LLM code will be basically turning down the work of the worlds best programmers running at 50x speed in couple years, and will functionally doom any software project that enforces such a policy.

The problem is that some GNU packages, Emacs among them, have a policy that copyright of the code must be assigned to the FSF. This policy exists because the FSF and GNU have gotten legal advice to the effect that all owners of a project must sue together to sue against copyright violators. So I don't forsee this policy changing while LLM output is not copyrightable.

Re: I built a GPU back end for Emacs

#107

"That was the moment the architecture stopped being a promise and became a fact." The post is AI generated as well, right?

it certainly has the tells... I could be charitable and say maybe since it's a bilingual blog it was generated as a type of translation from the original source, but that post itself seems only available in English

Re: I built a GPU back end for Emacs

#108

Interesting improvement. My biggest issue with Emacs and the reason that I left it was because it was not multi-threaded. I wonder if is/can be multi-threaded now.

> because it was not multi-threaded I'm honestly curious, what kind of multi-threading you use, in whatever you're using now instead of Emacs? Can you share some practical example(s)? I'm not trying to trick you, I'm just curious for what kind of complex tasks possible there and where Emacs comes short.

I fetch my google calendar every few minutes to get everything into my agenda. The API request is async, but writing to the calendar file and some additional processing made Emacs hang for 10 seconds at a time. The LLM-inspired solution was to spawn entire new emacs processes to do the work in the background. It's pretty cool that it works, but it feels like it shouldn't - and wouldn't with 2+ threads - have been that complicated.

Re: I built a GPU back end for Emacs

#109
post #102
post #42

Emacs user for >32 years now. It's a pity this won't get merged. There is a big usability/accessibility factor to consider here: I really wish I could have something like the Ghostty cursor_blaze.glsl shader for highlighting where the cursor is when you switch windows/buffers/apps. Most people think GPU equals silly toys like video in a text window, but there is much more to it than that. [and yes, I know about beaco…

The feature is LLM generated, and also doesn’t bring any speed ups, only slowdowns

Did you read the article to the end? It does bring speed ups for high resolution, like 4K. It's at more conventional laptop display sizes that its roughly on-par with, but the GPU scales better with pixel count.

Re: I built a GPU back end for Emacs

#110
post #102

Earlier quoted context omitted.

The feature is LLM generated, and also doesn’t bring any speed ups, only slowdowns

Did you read the article to the end? It does bring speed ups for high resolution, like 4K. It's at more conventional laptop display sizes that its roughly on-par with, but the GPU scales better with pixel count.

Only on Linux it seems. The fact that it makes rendering slower on lower resolution is a big concern.

I’m all for speeding up Emacs as a long time user, but I share emacs maintainers stance on not accepting llm code.

Post reply on HN