Hacker News new | ask | show | jobs
by KirillPanov 1849 days ago
Emacs uses a much less advanced data structure called a "gap buffer":

https://www.gnu.org/software/emacs/manual/html_node/elisp/Bu...

https://news.ycombinator.com/item?id=15199642

It's basically just two stacks of lines, where a line is an array of characters. One stack has the lines before the cursor, the other has the lines after the cursor (in reverse order).

I use emacs, but ropes are a much better way to go if you're starting from scratch.

1 comments

Is it though? After about 20 years of Emacs I have never thought it was slow regardless of anything found in etc/JOKES
The last 20 years have been OK. Before that not really so.

I remember starting emacs on a VAX-750 with 4 MB main memory and 8 users in the 80s.

Even in the 90s with Suns and competitors in single user usage emacs could bring things to a halt. Especially when starting a certain messaging client (hej LysKOM).

Well, back then emacs was a resource hog like today VSCode using 8GB and swapping as someone wrote here. (I would not touch VSCode with a stick). Times have changed, but emacs rather little. So today it can nearly be considered lightweight and efficient.

opening any file with extra long lines (for example minified js files which somehow end up littering any codebase) in emacs is still bring emacs to its knees, especially if you have line wrapping enabled.
Ah, I don't have line wrapping enabled by default.