Hacker News new | ask | show | jobs
by userbinator 390 days ago
The core data structure (array of lines) just isn't that well suited to more complex operations.

Modern CPUs can read and write memory at dozens of gigabytes per second.

Even when CPUs were 3 orders of magnitude slower, text editors using a single array were widely used. Unless you introduce some accidentally-quadratic or worse algorithm in your operations, I don't think complex datastructures are necessary in this application.

1 comments

The actual latency budget would be less than a single frame to be completely non-noticable, so you are in fact limited to less than 1 GB to move per each keystroke. And each character may hold additional metadata like syntax highlight states, so 1 GB of movable memory doesn't translate to 1 GB of text either. You are still correct in that a line-based array is enough for most cases today, but I don't think it's generally true.
Movement of GB's of data being noticeable should be considered a feature, imho.

And if those GB's represent text, with user trying to edit that as a single file, well then... PEBKAC.