10

I have a HUGE (and I mean huge) text file that I am going to process with vim. I could process it using two different (debian) machines.

One is duel-core and one is octo-core. A single core on my duel-core box a faster than a single core on my octo-core box.

Does 'vim' utilize multithreading in such a way as to make my work go faster on my octo-core box?

Questionmark
  • 3,945
  • Is there a better place to put this? – Questionmark Jan 15 '15 at 19:49
  • You could try splitting the file into pieces and editing them and combine them back as discussed here. But it's just an alternative and doesn't answer your original question though. – Ramesh Jan 15 '15 at 19:53
  • 5
    If your file is that big, maybe you don't need an interactive text editor. Look at sed or awk, they were designed for this very purpose and are much faster than vim. Vim is not suited for large files because the file has to fit into RAM (not true for sed and awk). BTW, vim is single-threaded. – Marco Jan 15 '15 at 19:59
  • @Marco tbh that's as complete of an answer as I can imagine. You may want to post it as such so it attracts the eyeballs. – Bratchley Jan 15 '15 at 20:04
  • 1
    Note sed is a streaming version of vi, so same commands as Vim. – ctrl-alt-delor Jan 15 '15 at 22:55

1 Answers1

16

No, vim is not multithreaded. Multiple cores won't help you here.

First we have to agree on what a huge file is. I suppose you mean a file larger than the RAM size. Vim was not designed for large files. Furthermore, when not sufficient line ends are present, vim might not be able to open the file at all.

Decide if you want to just read the file content or if you want to edit it. The program less has many features unknown to most people and is actually a very good tool to view large files because it doesn't require the file to fit into memory.

If you want to edit the file you are better off with non-interactive text editors like sed, awk or maybe a perl script. Those editors were designed for this very purpose and happily process files larger than your RAM.

Also see my answer to: What happens if I use vi on large files?

Marco
  • 33,548