-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make render-time use of mapnik::projection faster and more lock-free #1703
Comments
|
The limitation of 3. above is when the |
3 and 4 above allow for completely avoiding proj4 initialization for the merc<->longlat transformation case. Benchmarks show a massive different in speed from this work:
|
…2. centralize proj4 strings into constants, 3. tweak projection benchmarking to allocate objects in loop so we can test that specifically - refs #1703
2,3,4 now done and available for testing in |
for reference, current tests (in master) test purely the OS X 10.7 with proj 4.8 installed via homebrew:$ ./benchmark/run 11 12 13 14
starting benchmark…
11) threaded -> lonlat -> merc coord transformation (epsg): 670 milliseconds
12) threaded -> merc -> lonlat coord transformation (epsg): 170 milliseconds
13) threaded -> lonlat -> merc coord transformation (literal): 670 milliseconds
14) threaded -> merc -> lonlat coord transformation (literal): 540 milliseconds
...benchmark done Ubuntu 11.10 with proj 4.7# ./benchmark/run 11 12 13 14
starting benchmark…
11) threaded -> lonlat -> merc coord transformation (epsg): 34410 milliseconds
12) threaded -> merc -> lonlat coord transformation (epsg): 110 milliseconds
13) threaded -> lonlat -> merc coord transformation (literal): 30400 milliseconds
14) threaded -> merc -> lonlat coord transformation (literal): 23550 milliseconds
...benchmark done |
…the bottleneck for key transformations - refs #1703
Because we store
srs
values formapnik::map
andmapnik::layer
as strings, during rendering we dynamically set upmapnik::projection
objects. The problem with this design is that the creation ofmapnik::projection
objects is very expensive because a proj4 projection is initialized inside and proj4 locks potentially multiple times: 1) while creating it'sproj_ctx
. (even with latest proj4), and 2) when reading the CSV files inPROJ_LIB
in order to translate ESPG codes to proj4 literal strings when using projection syntax like+init=epsg:3857
.We aim for a totally lock-free rendering pipeline but currently we face at least
layers * 2
# of locks per render because of the first creation of amapnik::projection
object and then due to the copy when it is attached to themapnik::proj_transform
object. This is a non-trivial problem if many maps are being rendered concurrently and especially tragic given that this overhead will occur even if the map is not needing to reproject any data.potential solutions
Store
mapnik::projection
objects on layer and map objects. This would avoid needing to allocate (and de-allocate) them at render timeStore
const&
to projection objects in theproj_transform
class to avoid extra copies and allocationsImplement a native
is_geographic
function that does not require proj4. In cases where no-reprojection will happen for a given render then this could set us up for not needing to use proj4 at allImplement custom transformations for wgs84 and mercator, so for the extremely common case of data stored in wgs84 and being projected into mercator we could still avoid all overhead of proj initialization and locking.
Also, we should make proj4 able to be fully disabled at compile time if you don't need any fancy projection support.
The text was updated successfully, but these errors were encountered: