My 4K Write Program is nowhere near as fast as benchmarks
So I wrote this program that writes 100,000 4K .txt files onto disk.
HD Tune Pro says my 500 MB RAM disk gets ~90k IOPS for 4k files, ~350 MB/sec
Here is my program:
Code:
#include <iostream>
#include <fstream>
#include <cstdio>
int main() {
char filename[100];
for(double o = 1; o<100000; o++)
{
std::sprintf(filename, "%05.0lf.txt", o);
std::ofstream ofs(filename);
for(int i = 0; i < 77; i++)
{
ofs << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
}
ofs << "aaaaaaaaaaaaaaa";
}
return 0;
}
Which gives me ~400 IOPS on the ramdisk. How can I make this go faster?
Thanks!