If you would like to improve the running performance of Python, try
1) Use profile/cProfile to benchmark your program, find the possible hotspot, switch to correct data structure to solve problem etc.
2) If after step 1), the performance doesn't still meet the requirement, then
a) Consider PyPy/Pyrex
b) Rewrite the hotspot logic by using C++

本文介绍了改进Python程序性能的方法,包括使用profile/cProfile进行基准测试、优化数据结构、考虑使用PyPy/Pyrex和C++重写热点逻辑等步骤。
1162

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



