There is a text file size of 4 gigabytes. Approximately 100 million lines. All data is structured line by line. It is required to process this file according to a certain algorithm and as a result to form a new file. The question is how to work with this file more efficiently:
- Sequentially read the file with slices, working with them, until the end
- Load file into memory and work with all data.
What will be more effective in terms of performance? I myself think that option 2, because I heard about the barriers in memory, that it is better to store identical data in neighboring slots, rather than jump back and forth, and it is easier for the kernel to perform identical operations than to perform different tasks.
File.ReadLines(notReadAllLines!). - VladD