+ 1
fstream performance
I have a object of std::fstream and trying to write a file using same. I am doing below operations: fstream file.open(fileName); float a,b,c; file << a; file << " "; file << b; file << " "; file << c; Is this good option to do? What if I do as below: string s = to_string(a) + " " + to_string(b) + " " to_string(c); file << s; Will second version improve performance or not?
1 ответ
+ 2
You can use this to Benchmark ...
https://code.sololearn.com/cDpd9e27N7XC/?ref=app
you would use it like this
{ // put the part which you need to benchmark in block
Timer timer{"name of benchmark"};
// perform the task
}