Right now I have a program that loops, and if given the right conditions writes to disk.
Because of this it write a lot of small files, and currently I am naming the files with std::sprintf and writing to that file with std:fstream.
Without calling this write to disk function it takes 4 seconds to finish, but with it (written on a ram disk) it takes 24 seconds, 6 times as long!
While this doesn't matter that much in certain situations it runs much longer (2 minutes without writing) and could be much longer.
Would there be any other faster way in order to make multiple small files?
std::sprintf(filename, "%05.0lf.txt", numberofFiles);
for(int o = 0; o<100; o++)
if( outputClean[o] != '\0')
ofs << "abcde " << outputClean[o] << " " << outputClean[o] << endl;
for(int o = 0; o < 100; o++)
if(outputClean[o] != '\0')
ofs << "fghij ";
for(int i = 1; i < 10; i++)
if(outputClean[o][i] != '0')
ofs << outputClean[o][i] << " ";
ofs << "\n";
ofs << "END";