王歆瑶20190919-3 效能分析

此作业要求参见https://edu.cnblogs.com/campus/nenu/2019fall/homework/7628

git地址:https://e.coding.net/wxyao/wangxiny.git

要求0 以 战争与和平 作为输入文件,重读向由文件系统读入。连续三次运行

统计表:

 要求1 给出你猜测程序的瓶颈。

 我猜测瓶颈在这段:

while (fin >> temp)
{
int len = temp.size();
char tmp[40] = "";
int j = 0;
for (int i = 0; i<len; i++)
{
if (isalpha(temp[i]) || temp[i] == '-' || temp[i] == '\'')
{
tmp[j] = temp[i];
j++;
}

}
string tmp2(tmp);
wmap[tmp2]++;
}

 惭愧,能力有限,不知道如何优化。

猜你喜欢

转载自www.cnblogs.com/wxyao/p/11566876.html