artemp/trac2github — Issue #850: parallelize datasource.features() query
Author: artemp
Created: 2011-10-09 20:53:14+00:00
State: open
Labels: Core_Library

Rendering must happen serially, to ensure proper painting of features. But on machines with sufficient memory (or perhaps if using postgres with cursors) mapnik datasources could be queried in parallel or asynchronously before or just after rendering of the first layer begins. So instead of the normal query, render, query, render... approach we could create a pool of threads at render time, dispatch N datasource queries, and have each callback when they return a featureset. Rendering would commence in order of the layers and only pause if the next layer has not yet returned from the thread pool.

This could be done using boost::thread in c++ natvely, or perhaps key parts of feature_style_processor.hpp could be bound from nodejs as to allow each part of the rendering to be controlled by api calls (and therefore async control flow could happen outside c++ even).