Just a question regarding about file reading in threading.
To read a 10MB text file, or read two 5Mb each files which is identical to the 10Mb one, which is faster? Let say the processing unit consist multithre开发者_C百科ading.
If you read the file from disk I would guess that the non-threaded, single 10MB file approach will be faster, since you would otherwise have two threads competing to use the same shared resource, which in this case also is likely to be the slowest part in the chain. This could perhaps change if you keep the two files on different physical disks.
The best way to find out is to write code for both approaches and measure their performence in the kind of setup where it is intended to run.
精彩评论