Problem with big files (50+MB)

  • I has 16GB of DDR4 ram, ryzen 7. But in notepad++ I can read big files (50+MB) with big delay, it pause process for some time, for example 200MB text file, pause process for 10 second for every time when I turning pages.
    Please fix this delay, now 2021 year and it very big problem!

  • @User-Name ,

    Large plaintext files (50M, 100M, bigger) don’t go incredibly slow (10 second pauses) for me.

    Is it a plain text file, or does it activate one of the Language-menu entries (HTML, XML, JSON, C++, …, or a user defined language). Running one of the Language lexers can sometimes slow things down on a large file, depending on the complexity of the rules being highlighted.

    If it’s not a plaintext file, you might want to manually choose Language > None (Normal Text) (used to be Language > Normal Text or Language > N > Normal Text before a recent change).

    Or maybe you have a plugin that is doing some processing every time the screen is redrawn.

    But since you told us nothing other than size of file about your file, or which version of Notepad++ you are using or which plugins are installed, it’s all a guess. When asking for help in this forum, it’s really useful for you to go to Notepad++'s ? menu, Debug Info entry, and give us the information contained there (you can just Ctrl+C copy the text that’s highlighted in the dialog box, and paste it here)

  • For example 300MB c++ file I can’t replace any text. It caused 50 second pause… I need just disable c++ language and set as text ?

  • @User-Name said in Problem with big files (50+MB):

    I need just disable c++ language and set as text ?

    That would be a start. Try the language setting as @PeterJones suggests first and see how it works for you.

    If you are still having issues provide the Debug Info as he also asks, as that will provide additional information for forum members to help you.


  • @User-Name said in Problem with big files (50+MB):

    For example 300MB c++ file I can’t replace any text. It caused 50 second pause… I need just disable c++ language and set as text ?

    It’s what, more than 5 million lines of code (LOC) to get 300MB of source code even for dense code? All in one file? Yikes, talk about a maintenance nightmare!

    I ran some experiments with a dummy c++ that looked like

    #include <stdlib>
    int main() {
        return 0;
    int dummy(void) { return 32; }
    int dummy(void) { return 32; }
    int dummy(void) { return 32; }

    … with enough copies of dummy to get about 1M LOC for about 32MB file length.

    In Language=C++, a search-and-replace for 32; to 23; took 2-5min. Switching to Language=None/Normal Text and replacing the other way dropped to 1-2min. For my 8-core CPU, it was pegging one of the 8 cores at 100%, whereas the other cores were all sane usage levels. (My guess is that the search-and-replace is implemented in a single thread – at the scintilla/boost level, so not something that Notepad++ source code could change) because it’s a linear activity, so it doesn’t make good use of multiple cores)

    Huge files are hard to handle, especially in applications like Notepad++ that keep the whole file open in a single buffer; it makes for large memory requirements and for large cpu requirements when doing whole-file activities. Turning off the lexer (Language menu) and not using View > Function List feature will both speed things up, as will not having plugins working in the background. But at hundreds of megs, it will still be slow, and probably slower than you would like.

    I cannot imagine a corporate code-style-guide that would allow a single source file to be 300MB / 5M LOC. Even if filesize or LOC-per-file aren’t mandated or given guidelines, I cannot imagine maintaining a single file that has grown that big – whether in a corporate situation or in a personal or open source project.

    As a bit of advice, I would recommend, for the long term, refactoring that code into multiple files, which will be easier to maintain. If it’s mandated by management to not spend time refactoring, explain to them that even activities like simple search/replace calls will take 5 minutes each, and that it can really add up. If they still won’t approve the time to refactor, I feel sorry for you.

    If you’re stuck with 300MB source code, I might recommend a streaming-style search and/or search-and-replace command-line utility, rather than Notepad++, so it doesn’t have to be all in memory at the same time. Gnuwin32 project on SourceForge has functional versions of grep for searches and sed for search/replace, which I use when I don’t want to load the whole file into memory (I like those because I have a lot of linux experience with those tools, and these are gnu-compatible versions, old but functional enough for me). Or the windows powershell command-line-environment has some good command-line tools, but I am not a powershell expert, so cannot recommend large-file or multi-file search-and-replace syntax. And support for grep/sed and/or powershell is not on-topic for this forum, so you’d have to find help elsewhere.

Log in to reply