2
$\begingroup$

Im not sure if this the right place to ask but I'm wondering why a computer takes forever to open huge text file like 1GB but if I open a video file (mkv) for example with 10GB like a movie it will be opened very fast.

Why the computer doing this ? What is the difference between the two operations?

$\endgroup$

closed as off-topic by Juho, Evil, hengxin, adrianN, Yuval Filmus Dec 26 '16 at 9:46

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about computer science, within the scope defined in the help center." – Juho, Evil, hengxin, adrianN, Yuval Filmus
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ This is unfortunately off-topic here. $\endgroup$ – Yuval Filmus Dec 26 '16 at 9:46
8
$\begingroup$

The difference would be between loading the complete file into memory and reading the file part-by-part as you need each part.

If I open a file in some applications I am asking for it to be fully loaded into memory all in one go.

If I play a movie file or DVD in most player applications the applications will be structured to just fetch data as it needs it, not all at once.

There are different ways to open files and devices in operating systems and they are not all the same.

$\endgroup$
0
$\begingroup$

You must have noticed while performing the seek operation on the movie player it takes a moment (the slightest of it though) to resume the playback. This time is used to bring the desired part of the movie from the disk to the main memory if it is already not present in the cache or the memory. In case of text editors the whole file is loaded at once which takes considerable amount of time and also affects other programs. Moreover the amount of memory allocated to a process by the OS also varies depending on the type of program.

$\endgroup$
0
$\begingroup$

Text editors often need to read the whole file to index and count lines before displaying it. There is also character code conversions (which means that the CPU must parse each byte one by one).

From my experience, non-unicode editors as nedit are faster than modern ones, with its regexp parser, it is useful for analyzing crazy large log files.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.