So, I went ahead and buffered the whole file on to a variable. I hope this is much better than reading line by line?
I don't think so.
If you read line by line, you can do some processing, while the operating system pre-fetches the next blocks from the file in background.
If you read the whole chunk into memory, the whole file must be read first.
is it possible to create something like threads or do multiple checks at the same time?
Yes. Or separate processes. Your operation sytem should keep the read blocks in its buffer, so that only the first process actually reads it from disc, and subsequent ones get it from the buffer cache.
In reply to Re: buffering from a large file
by moritz
in thread buffering from a large file
by cedance
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |