K
kasthurirangan.balaji
Hi,
Below is the code.
#include <fstream>
#include <set>
#include <string>
#include <iterator>
#include <algorithm>
main()
{
typedef std::set<std::string> stringset;
stringset list;
std::ifstream ifstr("data.dat");
std::copy(std::istream_iterator<std::string>(ifstr),
std::istream_iterator<std::string>(),
std::inserter(list,list.begin()));
}
If i compile with "-O3" optimization option, what would be the actual
optimization?? Since i read everything(line by line) into memory that
is a binary tree(c++ set), would be number of disk reads be reduced??
Would the file be mapped into memory directly and then into set?? I
probably see this depends on the compiler and implementation, but like
to have more idea of what happens in general.
Thanks,
Balaji.
Below is the code.
#include <fstream>
#include <set>
#include <string>
#include <iterator>
#include <algorithm>
main()
{
typedef std::set<std::string> stringset;
stringset list;
std::ifstream ifstr("data.dat");
std::copy(std::istream_iterator<std::string>(ifstr),
std::istream_iterator<std::string>(),
std::inserter(list,list.begin()));
}
If i compile with "-O3" optimization option, what would be the actual
optimization?? Since i read everything(line by line) into memory that
is a binary tree(c++ set), would be number of disk reads be reduced??
Would the file be mapped into memory directly and then into set?? I
probably see this depends on the compiler and implementation, but like
to have more idea of what happens in general.
Thanks,
Balaji.