王歆瑶20190919-3 效能分析

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

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

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

 

 

CPU参数:Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz 2.40 GHz

统计表:

 要求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]++;

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

posted @ 2019-09-24 23:21  新芽*  阅读(127)  评论(0编辑  收藏  举报