Why is it so slow to open up a 50 MB text file in a GUI text editor?

3

I've always wondered why is it so slow to open up a 50 MB text file, either in Notepad++ in Windows or Pluma in Linux.

I have a computer with 16 GB of RAM, can't the OS just put the whole file in RAM and display it in seconds? I would have guess that copying 50 MB into the RAM would only take a second.

I can open up that text file with nano in seconds or I can grep something in it in seconds too. But why is it so slow with a GUI text editor?

Zurd

Posted 2016-07-24T01:12:37.357

Reputation: 193

Answers

3

I would guess that Notepad++ might take a while if you have syntax coloring enabled, and if it is a C or Java file, looking for sub-routines, functions, etc. Not familiar with Pluma. If it is a programming code file, you could copy it to have a .txt extension, and open that version, and see if it opens faster.

Mark Stewart

Posted 2016-07-24T01:12:37.357

Reputation: 279

1Thanks for your comment, there's no syntax coloring but I've found why it is so slow and it's just because there's is some really long lines in it. An SQL INSERT statement. If there's no long lines, it's quite fast to open up a text file with Notepad++ or Pluma. I'm still wondering why it would be so slow with long lines though. – Zurd – 2016-07-24T03:22:43.520

1@Zurd line wrapping? Is it on or off by default? – Tair – 2016-07-24T05:58:24.607

@tair Line wrapping is off but if I enable it, it is faster to open! Thanks for the trick! – Zurd – 2016-08-09T20:13:12.440

@Zurd That is interesting, because I expected line-wrapping=off to be faster :) – Tair – 2016-08-10T08:02:04.910

0

I would look at it this way. Your computer might have 16G of RAM, but the usage or resources is necessarily rationed by the OS.

Just because there's still some memory left does not give a particular program the right to gulp it down without throttling. Otherwise there might be a side effect.

What I cannot say immediately is if you have a configuration option to give a privileged share to your program.

Ifedi Okonkwo

Posted 2016-07-24T01:12:37.357

Reputation: 169