>>If files are sitting on the local drive, the second approach works faster (difference about 1 sec.). If they are located on the NetWork drive, the first approach is faster ~3sec. File is 5MB.
>>
>>I also can not find the optimum size in fread().
>
>When I said 'round numbers', I meant ROUND, like 2048, 4096, 8192, 16384, 32768, 65536 and such :).
You know, sometimes you have to be explicit :) Different cultures, mentalities, etc. :) I understood you wrongly...
With numbers which just have zeros when written in decimal, I wouldn't know which would give you better alignment and less overhead (or does it matter at all - simple matter of network being more or less loaded at some point may ruin your benchmarking).
Well, I ran few tests (since each took 10-14 sec. I finished with the tests for now). Seems like 131072 is the winner. I put it here for a while...
>
>I figure you'd need a little more testing, probably with the buffer size about four times bigger each time, to find what suits your OS/network the best. I can't imagine any rule here, it all depends.
If it's not broken, fix it until it is.
My Blog