Ooops tried to retract post after discovering that I had mis-read what was happening but wasn't fast enough on the trigger.... Sorry I lost original wrong comment...but it was wrong anyway.
Update Again: here was original post:
---
I think that there is a flaw in your benchmark. Many file system resources are allocated on a per process basis, not per thread. It looks to me like your threaded version has a single process that's trying to open the same file 4 times and read from 4 different file positions? This can potentially cause big trouble and fighting.
I suggest recoding the benchmark so that no file is open more than once in the same process. In this case, that means each thread needs to be doing an independent list of files.
---
I was mistaken -- the OP's code already does what I suggested (the overall process never has the same file open twice - each thread is independent) - see BrowserUk's response..
In reply to Re: Reading from file in threaded code is slow
by Marshall
in thread Reading from file in threaded code is slow
by amcglinchy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |