I've verified that the input files and the code is exactly the same when I run Heroku locally and Heroku on the web. I checked and checked and checked again because I couldn't believe the results.
When I run cprofile locally, I get this:
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)
When I run cprofile on the web, I get this:
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)
The total function calls increase from 2.8m to 67m (23x), and the distance checks increase from 0.6m to 13m (22x).
What could possibly be causing this? I'm completely out of ideas.