I'm writing out a large numerical 2 dimensional array to a binary file (final size ~75 MB).
I'm doing this on a linux system. First, is there a better method or syscall other than fwrite to write the file as fast as possible?
Second, if I should use fwrite, then should I just write the whole file as 1 contiguous line?
fwrite( buf, sizeof(float), 6700*6700, fp );
or write it as a series of chunks
fwrite( buf, sizeof(float), 8192, fp );
fwrite( *(buf+8192), sizeof(float), 8192, fp );
....
If I should chunk the writing, how big should each chunk be?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…