3 ms·
Now I'm curious how Vim deals with large files. I'm assuming the went the pread route.
by snarfy 8y ago
Now I'm curious how Vim deals with large files. I'm assuming the went the pread route.
- rocqua 8y agoVim needs to do a lot more special stuff, because it has to handle random insertions and deletions. Doing those things to a file (mmaped or otherwise) requires moving all data after the edit. If I recall correctly, vim/vi uses a linked list of 'chunks' that is dynamically merged. For long files I would expect some form of lazy loading of chunks.
- dullgiulio 8y agoThat's right. The key data structure is the rope: https://en.wikipedia.org/wiki/Rope_(data_structure) https://en.wikipedia.org/wiki/Rope_(data_structure)
- deleted 8y ago[deleted]
- snarfy 8y agoNice! I thought xi was the only editor that used ropes.