When opening large log files (well, not that large, but 80mb is still a lot of text!), I've always used Vim since it loads them almost instantly. Other text editors like Notepad, Notepad++, etc will take > 10 seconds to process and load the file. What is the reason for this? What makes Vim so fast?

  • 8
    Switch on syntax highlighting and be surprised how slow vim can become
    – Marco
    Jul 24, 2012 at 13:32
  • 11
    To the close voters: I would argue that this question is constructive - as the answer indicates, there are techniques Vim uses that make it more efficient with larger files than some other editors. That's a concrete answer, which can be supported by facts/references. And I'm not sure why people can consider this localised; there's a clear difference in how the editors handle files that affects a lot more than a small geographic area, a specific moment in time, or an extraordinarily narrow situation.
    – Bob
    Jul 24, 2012 at 14:16
  • 1
    @Bob - I fail to see how the answer to this question solves any problems.
    – Nifle
    Jul 25, 2012 at 8:18

1 Answer 1


There's a multitude of tricks that editors can use to optimize dealing with large files.

One is to only work with what they need. That means not trying to parse the entire file for things like line counting, width measurements, word wrapping, syntax highlighting, XML validation, HTML rendering, Undo, etc. There is the LargeFile Plugin available for Vim which will disable a number of Vim's features when a "large" (as defined by the user) file is opened. The Faster loading of large files page on Vim's wiki mentions some of the disabled features: ignore filetype (for syntax highlighting/parsing), disable undo, switch to read-only mode. There's other changes too, but they seem to be targeted towards memory conservation than speed.

Another is memory mapping. Instead of reading the entire file into memory, tell the underlying OS to map a view of the file directly into the processes memory space. I'm not sure if Vim in particular does this, but other editors can and do.

Those are probably the biggest 2, but there's certainly more.

  • Do you have a reference for vim using any of these techniques?
    – slhck
    Jul 24, 2012 at 14:36
  • I can't comment on memory mapping in particular, but the first can definitely be done. Edit forthcoming.
    – afrazier
    Jul 24, 2012 at 15:07
  • vim.org/sources.php
    – LawrenceC
    Jul 24, 2012 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.