[C++] Is it possible to use threads to speed up file reading ?
- by Mister Mystère
Hi there,
I want to read a file as fast as possible (40k lines) [Edit : the rest is obsolete].
Edit: Andres Jaan Tack suggested a solution based on one thread per file, and I want to be sure I got this (thus this is the fastest way) :
One thread per entry file reads it whole and stocks its content in a container associated (- as many containers as there are entry files)
One thread calculates the linear combination of every cell read by the input threads, and stocks the results in the exit container (associated to the output file).
One thread writes by block (every 4kB of data, so about 10 lines) the content of the output container.
Should I deduce that I must not use m-mapped files (because the program's on standby waiting for the data) ?
Thanks aforehand.
Sincerely,
Mister mystère.