Big files and logs
ted is built to open big files without making you wait. These are its numbers on a 100 MB log, on a laptop with an Intel Core i5-1235U.
| What | Time |
|---|---|
| First screen, from opening the file | 77 ms |
| The whole file loaded, in the background | 146 ms |
| Painting a frame while scrolling | about 1 ms |
| Painting a keystroke | about 2 ms |
| Counting every match of a search | about 30 ms |
How it works
- A file of 8 MB or more shows its first 256 KB at once, read only, while the rest loads. The gutter already has room for every line, so nothing jumps when the whole text arrives, and editing starts then.
- Only the lines on screen are laid out and painted. A very long line, such as a minified JSON, is laid out only around the columns on screen.
- The text lives in a rope, so an edit in the middle of a 100 MB file costs about the same as at its end.
- Searching, highlighting and saving run in the background.
Opening the 100 MB log adds about 110 MB of memory to the window, the size of the file plus the index of its lines.