It improves the performance of the CensusReporter lookup.
As suggested by @iandees we now load the CensusReporter API results by table.
Each table generates it's own request. Test via command line showed that the performance should be doubled. Each requests takes a small time, though the merging could take a bit longer.
The small requests take about 4s and the old big two requests took a combined 7s.
We tried to seperate and optimize as much as possible.
The censusReport will be initialized with a tracts array. The tracts array should have the following keys: geoid, feature
the feature should be a geojson feature and have a property of aland which will be used to calculate the density.
There is only one public method for getting the data and one can provide a callback function which will be called with the results appended to the provided tracts. Or if you prefer to use promises the returned result is a jQuery promise. it will be resolved with the result, once every request is made.
Underscore.js is used to provide convenience methods and achieve better readability.
What does this PR do?
It improves the performance of the CensusReporter lookup. As suggested by @iandees we now load the CensusReporter API results by table.
Each table generates it's own request. Test via command line showed that the performance should be doubled. Each requests takes a small time, though the merging could take a bit longer. The small requests take about 4s and the old big two requests took a combined 7s.
We tried to seperate and optimize as much as possible. The censusReport will be initialized with a tracts array. The tracts array should have the following keys:
geoid
,feature
the feature should be a geojson feature and have a property ofaland
which will be used to calculate the density.There is only one public method for getting the data and one can provide a callback function which will be called with the results appended to the provided tracts. Or if you prefer to use promises the returned result is a jQuery promise. it will be resolved with the result, once every request is made.
Underscore.js is used to provide convenience methods and achieve better readability.
Related Ticket
13