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

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

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

王歆瑶20190919-3 效能分析

 

王歆瑶20190919-3 效能分析

 

王歆瑶20190919-3 效能分析

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

统计表:

王歆瑶20190919-3 效能分析

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

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

相关文章:

  • 2021-07-20
猜你喜欢
  • 2021-11-09
  • 2021-09-23
  • 2021-07-15
  • 2021-12-11
  • 2021-09-25
  • 2021-08-24
  • 2022-01-16
相关资源
相似解决方案