第三次作业
学号:2017*****7138
姓名:王宁
码云仓库:https://gitee.com/w0912/snake/blob/SE7138/%E7%AC%AC%E4%B8%89%E6%AC%A1/zuoye.py
一.程序分析
1.读文件到缓冲区

2.处理缓冲区 bvffer代码,统计每个单词的频率,存放在字典word_freq

3.输出top10的单词

4.创建一个函数进行文本测试

二.性能分析结果及改进
- 指出执行次数最多的代码,执行时间最长的代码。
the 19574次
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.698 0.698 {built-in method builtins.exec}
1 0.003 0.003 0.698 0.698 <string>:1(<module>)
1 0.008 0.008 0.695 0.695 zuoye.py:37(main)
1 0.124 0.124 0.338 0.338 zuoye.py:20(process_buffer)
1 0.000 0.000 0.294 0.294 zuoye.py:6(process_file)
1 0.294 0.294 0.294 0.294 {method 'read' of '_io.TextIOWrapp
三.此次任务的总结与反思
此次任务我合理的运用互联网的用处,利用了强大的搜索功能。
不满的是大部分都不是太会,智商欠缺的很多。

浙公网安备 33010602011771号