I am looking for fast conversions. I found out that converting with atof is much more faster than using the stringstream like the below tests.
What I look for now is a fast way to convert from double to char*
I have a problem to find this conversion.
char* to double takes 3.1 sec
double Number1;
char* Num = "8.12";
for(int i = 0; i < 2000000; i++)
{
Number1 = atof(Num);
}
MessageBox::Show("Finish");
std::string to double takes 35 sec
double Number1;
std::string Num = "8.12";
for(int i = 0; i < 2000000; i++)
{
stringstream v1(Num);
v1 >> Number1;
}
MessageBox::Show("Finish");
double to std::string takes 51 sec
double Number1 = 8.12;
std::string Num;
for(int i = 0; i < 2000000; i++)
{
stringstream v1;
v1 << Number1;
Num = v1.str();
}
MessageBox::Show("Finish");