LTimeCount tt;
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetStrNum(stephdrDataVector[i+2]));
TimeTestEnd(tt);
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetNumberAfterA(stephdrDataVector[i+2],'='));
TimeTestEnd(tt);
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetDataBehindStr(stephdrDataVector[i+2].GetBuffer(),"="));
TimeTestEnd(tt);
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetNumberStartN(stephdrDataVector[i+2],6));
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetStrNum(stephdrDataVector[i+2]));
TimeTestEnd(tt);
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetNumberAfterA(stephdrDataVector[i+2],'='));
TimeTestEnd(tt);
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetDataBehindStr(stephdrDataVector[i+2].GetBuffer(),"="));
TimeTestEnd(tt);
tt.Start();
for(int j=0;j<1000000;j++)
CurRepeatPiece.X=atof(GetNumberStartN(stephdrDataVector[i+2],6));
TimeTestEnd(tt);
几个字符串查找的方式,没优化的,用字符串操作函数比较快一点
本文通过对比不同字符串查找方式的执行效率,发现使用专门的字符串操作函数可以显著提高处理速度。测试中采用循环调用的方式,对同一数据集进行了多次处理,并记录了每次处理的时间。
4131

被折叠的 条评论
为什么被折叠?



