@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.