当我在网上运行Heroku本地和Heroku时,我已经验证输入文件和代码完全相同。我检查并检查并再次检查,因为我无法相信结果。
当我在本地运行cprofile时,我明白了:
PATH: '/array_summary/'
2830886 function calls (2804702 primitive calls) in 2.710 seconds
Ordered by: internal time, call count
List reduced from 1530 to 30 due to restriction <30>
ncalls tottime percall cumtime percall filename:lineno(function)
586965 0.773 0.000 1.009 0.000 /home/redacted/graph_node_store.py:23(distance_squared)
7444 0.409 0.000 1.537 0.000 /home/redacted/graph_node_store.py:28(find_coordinate)
1185414 0.238 0.000 0.238 0.000 /home/redacted/subarray_graph.py:64(coordinate)
当我在网上运行cprofile时,我明白了:
PATH: '/array_summary/'
67343081 function calls (67255889 primitive calls) in 128.422 seconds
Ordered by: internal time, call count
List reduced from 1439 to 30 due to restriction <30>
ncalls tottime percall cumtime percall filename:lineno(function)
13485728 35.795 0.000 54.904 0.000 /app/redacted/graph_node_store.py:23(distance_squared)
28610118 20.720 0.000 20.720 0.000 /app/redacted/graph_node.py:21(coordinate)
10049 17.080 0.002 99.673 0.010 /app/redacted/graph_node_store.py:28(find_coordinate)
总函数调用从2.8米增加到67米(23倍),距离检查从0.6米增加到13米(22倍)。
可能会导致什么?我完全没有想法。