3 ms·
I don't applaud that. I think that he missed one important step in the design of a text editor... There's premature optimisation, as in: "I'll use a nice, buff
by viraptor 17y ago
I don't applaud that. I think that he missed one important step in the design of a text editor... There's premature optimisation, as in:
"I'll use a nice, buffered storage split in chunks that can be written back to disk to save memory... Even if it's going to be used for a field that accepts max 1KB of text."
And there's proper design:
"I'm writing a program which main/only purpose is to operate on text efficiently. That means I'd better create a good file/text abstraction up front, because otherwise I'll have to rip the whole thing apart and reassemble once people start using it for something longer than 1MB"
There's another haskell editor with vi-keymap and command-mode available - Yi. I think they're using the rope concept to deal with big files.
- cninja 17y agoDon't confuse "premature optimization" with "no optimization". As you and jrockway wrote, there certainly are more exotic data structures that are more appropriate for a text editor, but until there is enough of a text editor to do actual tests with, then choosing one of the options is premature. From what I read, the programmer's intent was not to write the most efficient editor, but to write an editor and see how the internal program structure will evolve as it becomes more efficient and/or feature rich. That knowledge and experience is sometimes more valuable then knowing what data structure to use.