|
|
|
|
|
by SamReidHughes
1581 days ago
|
|
A rope could frequently call malloc, or cause more time spent garbage collecting, and it takes up more memory, and the code is slower, especially in the 80's. Before modern JavaScript VMs, I made an in-browser text editor, and I tried using a finger-tree data structure with string segments. It was extremely slow. I replaced it with two strings. Then it ran at human speeds. Memcpying the whole string upon a keypress was faster than some fancy data structure. |
|
The moment you're willing to set an arbitrary limit above which you're ok with dropping performance, you can go very simple the way you did.
And that limit where things start to slow down can be far over the size of files most people need most of the time.
For my own part I'm fine with falling back to e.g. emacs the one time every few months I need do do something with an unusually large file.