Performance
Our DISTAL application is certainly working, but its performance leaves something to be desired. While the selectCountry.py
and selectArea.py
scripts run quickly, it can take two seconds or more for the showResults.py
script to complete. Clearly, this isn't good enough: a delay like this is annoying to the user but would be disastrous for the server if it started to receive more requests than it could process.
Finding the problem
Adding some timing code to the showResults.py
script soon shows where the bottleneck lies:
Calculating lat/long coordinate took 0.0110 seconds Identifying place names took 0.0088 seconds Generating map took 3.0208 seconds Building HTML page took 0.0000 seconds
Clearly, the map-generation process is the problem here. Since it only took a fraction of a second to generate a map within the selectArea.py
script, there's nothing inherent in the map-generation process that takes this long. So what has changed?
It could be that displaying the place names takes...