Why notepad is sometimes slow opening large files and how to make it fast

Ever notice how notepad can be really slow opening large files? Yeah I know why use notepad at all? For the simple reason that it might be the only editor on some random server that you logon to look at logs etc. Well there is Wordpad too but the default association for text and log files is to notepad and by the time you've double clicked a log file it might be too late. Also Wordpad is more heavyweight and can be lot slower scolling through and searching for text etc.

So you open some really large log file (in notepad) and notice the excruciatingly long time it takes. One day I got really frustrated and decided to investigate a bit. After a while I realized that even actions like maximizing or changing the size of the window took very long and a light bulb turned on that somehow notepad is redoing the whole layout of the text again so perhaps the word wrap feature is responsible. After all the word wrap feature (menu Format->Word Wrap) causes notepad to break lines at the visible width so that must be taking some time. Turns out that indeed if you switch word wrap off notepad becomes lightning fast. I tested with two log files of 11 MB and 103 MB on a Dual P4 3.2 GHz with HyperThreading on. For the 11 MB file I got times of around 16 s with word wrap on and 1.5 s with word wrap off! For the 103 MB it was 135 s and 15 s! I couldn't believe it was so simple and hadn't heard about this anywhere so I asked the people in my team if anyone knew about this. Apparently no one knew. I wonder how many people have realized this.

Now the problem is that at some point in time you've probably turned on word wrap in notepad and then forgottten all about it. It stays on and you keep suffering slow notepad file open times. I wish notepad had an option to turn word wrap off for files above a certain size. After all most text files you are going to use word wrap on wouldn't be too big. My suggestion is to keep word wrap off all the time and just make the default size of notepad as big as your screen allows. And if you really do need to use it then don't forget to turn it off lest you find yourself cursing the next time you open a large file :)

Comments

  • Anonymous
    November 11, 2005
    I am familiar with this feature, but what I can't figure out is why on one system log 50+ meg log files open almost immediately and on my other system they can take a minute or more. Both systems are dual Xeon, 400 FSB, 1 Gb+ memory, it doesn't make sense. Neither have word wrap on. If anyone has any ideas, please let me know at elevy_NO_SPAM_REMOVE_THIS@WeatherMetrics.com

  • Anonymous
    December 04, 2005
    The comment has been removed

  • Anonymous
    July 15, 2006
    It's amazing and funny how fast my post about the slow notepad issue has become the top result when you...

  • Anonymous
    July 16, 2006
    Eric: The other drive is probably in PIO mode. Right-click "My Computer", select "Manage". Open up the "Device Manager" node, then expand "IDE ATA/ATAPI controllers". Right-click on "Primary IDE Channel" then click "Properties". In the "Advanced Settings" tab, check that "Transfer Mode" is "DMA if available" rather than "PIO Only". Do the same for "Secondary IDE Channel".

  • Anonymous
    June 18, 2009
    PingBack from http://homelightingconcept.info/story.php?id=814

  • Anonymous
    August 11, 2010
    The comment has been removed

  • Anonymous
    September 12, 2010
    I think it's because of the notepad tries to load all the file contents into the memory. how about trying with the totalcommand, which has the text viewer, not fancy but fastest.

  • Anonymous
    November 23, 2015
    Notepad is an old application (as old as Windows). May not be modified for years. Seems it hasn't foreseen how to handle large files, that are larger than the size of floppy disk. Even when word-wrap is off, it is much slower compared to today's standards. See how quick Notepad++ is.