by userbinator · 2y ago · 0 comments
Someone has clearly not heard of Notepad nor used the prolific quantity of text editors for DOS that appeared in the 80s/early 90s, a time when memory bandwidths were in the low MB/s; or even before that, micros with CP/M where memory bandwidths were measured in KB/s (and the whole address space was only 64k). Modern systems have memory bandwidths of dozens of GB/s.
Or perhaps that old saying really applies: worse is better.
IMHO an array is all you need for a regular general-purpose text editor. I hate needless complexity in software, but unfortunately others seem to love it.
until you try to open up a multi gigabyte log file in notepad, and find that it's consuming all your system resources.
But opening that same file in sublime text works perfectly, scrolls fast and zero lag. Guess which one is my daily driver?
consequently the editors we used on those computers did not use this approach
however, a gap buffer is perfectly workable, and preserves most of the array's advantages, such as rapid text search. and so emacs continues to use gap buffers to this day
Q: How big is the 90th percentile text file?
64KB? That text file fits in some some level of cache and not RAM. An array is just fine most of the time.
Use a different purpose-built editor for those multi-GB text files.
And of course, if performance becomes an issue, we can make minor improvements then.