I thought notepad, being the most simple text reader is also the fastest, but I discovered when I tried to open very large text files that Wordpad opens them much much more quickly.

What could be the reason for this?

  • 2
    No. Notepad isn't one of the fastest. It's one of the most poorly written. – TOOGAM Nov 22 '16 at 2:12
  • Open a big files like hundreds of MBs or a few GBs with notepad and see. Other editors have no trouble opening it in a blink of an eye while notepad still have problem opening it – phuclv Nov 22 '16 at 2:40

Simple ≠ Fast

A plain basic editor like Notepad might be so simple that it doesn't have the ability to deal with complex situations, because it's only used for easy use cases.

A smart editor will determine many factors to decide which strategy is the best to use. For example instead of reading the file line-by-line or byte-by-byte like a stupid editor it'll load into a big buffer for fast reading later. Or it can map the file to memory. But how big should the buffer or the map area be? It depends on each specific case and the editor should also account for that. Instead of loading a whole several-GB file into memory and stuck because that simply doesn't fit in, a smart editor just checks the file size and loads only the currently viewing part then seek later when needed.

All of that require a more careful design with a lot of logic that doesn't exist in Notepad, since its source code hasn't changed much for a decade.

See Why can Vim open large files faster than some other text editors?


Windows 10 build 17713 introduced a lot of changes to Notepad, one of which improves Notepad's behavior on large files

  • We’ve improved the performance when opening large files in Notepad.
  • Notepad now supports Ctrl+Backspace to delete the previous word.
  • Arrow keys now correctly unselect text first and then move the cursor.
  • When saving a file in Notepad, the line and column number no longer reset to 1.
  • Notepad now correctly displays lines that don’t fit entirely on the screen.

Now there are also Unix line ending support, text zooming ability and status bar in word wrap mode

Announcing Windows 10 Insider Preview Build 17713

It's also confirmed that Notepad does use memory-mapped file, but that's the beginning part. The difficult thing is to parse the line and do the line wrapping. Even Notepad++ sucks when opening super huge files. See Poor performance with large .txt

| improve this answer | |
  • I have to correct you. Most windows code hasn't changed for a decade. (Closer to 17 years for a lot of it, actually). Notepad hasn't changed much since windows 1.0 (their first GUI, although it was available in MS-DOS), which is coming on 31 yearls old. – user657451 Nov 22 '16 at 4:44
  • 1
    @user657451 No, since Vista there has been a lot of rewrites, that's why it took MS 5 years to release Vista. And Notepad got a significant change in (IIRC) XP for Unicode and big file support. Before that it can't open files larger than 64KB – phuclv Nov 22 '16 at 5:31
  • That's funny, because in 10 there's still most of the NT4.0 snap-ins and .mscs. unchanged. And that registry thing. I'm pretty sure all they've really been doing is trying to work out how to port Mac's DE to work with Windows' APIs. And when that failed they went back and skinned CE3.0, and called it 8. – user657451 Nov 22 '16 at 7:10
  • 1
    @user657451 I'm sure there's a lot of legacy code in every Windows version because of compatibility, but in Vista there's significant changes like DWM, UAC... which were never there before. The basic structure obviously still be the same, because how can you drop the registry without breaking compatibilty. In what sense CE is similar to 8? It doesn't even have NT kernel – phuclv Nov 22 '16 at 8:06
  • no it's not even legacy code for compatibility, that's what the heinous winsxs folder is about. The number of W10 (98, NT, Vista, 7, 8) threads here would suggest "compatibility" isn't. s3.amazonaws.com/neowin/forum/uploads/monthly_04_2012/… – user657451 Nov 22 '16 at 8:15

Notepad is little more than a shell around the Windows Edit control. It was designed for editing small amounts of text and was optimized for such. Early versions had to run in systems with very limited resources where these optimizations were important. Windows 95 had an official requirement of only 4 MB RAM and for technical reasons the Edit control was limited to 64K of text. The NT platform was not so limited but it too had to work with limited resources.

Designing an editor for small files is relatively simple. Designing one that works efficiently with large files is anything but simple and requires a great deal of complex code. Small and simple editors do not work well with large files. All such editors, not just notepad, will choke on multi gigabyte files, even on a powerful computer. Some advanced editors can handle this with ease.

Notepad still works well for it's intended purpose and has had few changes over the years. The Windows Edit control is used in some form in most Windows applications so the potential for incompatibilities is great if major changes were made. Why take the chance of making unnecessary changes? Experience has shown that the most trivial of changes can cause incompatibilities in applications

If you need to edit larger files there are plenty of other editors available. Notepad was never designed for this.

| improve this answer | |

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.