4 ms·
You would have to load the entire file either way, even if you'd mmap() it, to be able to break the lines to find their extents and start offsets. mmap() isn't
by Findecanor 3y ago
You would have to load the entire file either way, even if you'd mmap() it, to be able to break the lines to find their extents and start offsets.
mmap() isn't entirely safe under Unix/Linux anyway because there is no Mandatory Locking. And it would still be useful only if you operate on the original text encoding.
- afc 3y agoYeah, good point. You want to at the very least be able to show the user on which line his cursor is, and that already requires reading all the contents from the start up to the cursor. You might as well read the entire file and also show the user the total line count.