Performance while reading a file line by line and reading the entire file

Is there a noticeable difference (theoretically) when reading line by line compared to reading the entire file at a time?

Reading the entire file has a negative effect on the amount of memory used, but does it work faster?

I need to read a file and process each line. I do not know if I should read one line at a time, process it or read the entire file, process everything, and then write to the output.

I already set up prgm to read line by line, and I want to know if it is worth changing to read the whole file (not easy given my settings).

Thank,

+5
source share
6 answers

- !

, , , RAM avaibale , , . , .

+2

, , , , I/O , . , . - .

, - . , 128 . 128 , . , 128 . , N, N + 1 .

+1

, , , . , , . , , - , ( ?), , ( ?). , , , , . , .

0

, , , . , , . , EOF.

, .

0

, , , , .. - .

. .

( , , , , , , .)

0

, ( , ). 1 Node js 3-4 fs.readFile(), , . , , " ". , , Node 1,5 64- . , , ( , , TCP). , , .

0
source

All Articles