3 ms·
I tend to agree with you. I'm using my own editor most of the time now. I occasionally fall back to Emacs still, but less and less. An early decision I made was
by vidarh 9y ago
I tend to agree with you. I'm using my own editor most of the time now. I occasionally fall back to Emacs still, but less and less. An early decision I made was to separate the buffers and almost all the rest of the editor code.
It's slow Ruby. It's storing everything in an Array of String objects. Which means one (Ruby-internal) allocation per line for the String object, and an additional allocation for the rest of the String if it exceeds something like 24 characters (Ruby String objects store characters in the object itself if it's short enough, but otherwise store a pointer to a separate buffer). Every keypress (because I've been lazy and not bothered optimizing away cases where it's not needed), the frontend requests the full set of visible lines from the backend via a TCP connection (using Drb for RPC), and re-applies syntax highlighting and other formatting, and in the process causes a flurry of additional object allocations. It's not optimized at all. It's almost flagrantly wasteful in many areas.
It started that way out of simplicity and a desire to get it to the point where I could use it for most of my editing ASAP. And it has remained that way so far because the lag just isn't noticeable to me, and it's very rare I edit large enough files for it to matter. I might optimize it at some point, but to me this seems like something people tend to worry too much about.