Hacker News new | ask | show | jobs
by 0xcde4c3db 3557 days ago
A screen-oriented text editor with undo and search/replace. Can you make it handle a 10MB file without "simple" operations having annoying delays? How about 100MB? 1GB? 100GB? With no line breaks in the file?
2 comments

With both emacs and vim you can certainly edit 500MB file. I concatenated all sources of recent Linux kernel 4.6.3 once. From what I remember it was all .c, .h and .S files. Resulting file has 542MB and 19'726'498 lines. I did it to test the text editor I am working on.

Some stats:

  $ time vim -c 'edit kernel-total' -c q
  real	0m8.162s
  user	0m7.687s
  sys	0m0.398s
  $ vim kernel-total ^Z
  $ ps aux | awk "/kernel-total$/ || NR == 1"
  USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
  hawski   10467  2.7 17.1 805120 670988 pts/2   T    17:41   0:07 vim kernel-total
  $ time emacs kernel-total -f kill-emacs
  real	0m7.155s
  user	0m6.869s
  sys	0m0.237s
  $ emacs kernel-total ^Z
  $ ps aux | awk "/kernel-total$/ || NR == 1"
  USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
  hawski   10825 43.8 14.8 857484 581152 pts/2   T    17:47   0:07 emacs kernel-total
With vim editing is quite smooth and with emacs it feels laggy. I only edited a bit, like entering a new line here and there, moving few pages down, going to the end of the file and to the top again. Saving is sluggish.
Is there any such editor?
I don't think so. Can a text editor do search and replace on a 100 GB file without a delay? You could construct an index, but that's not going to happen instantaneously either.
> Can a text editor do search and replace on a 100 GB file without a delay?

I meant that things like simply scrolling through a few pages or inserting/deleting a single character in the middle of the file shouldn't cause noticeable delays. Doing an operation that spans the entire file is different.