Amsterdam / django-gisserver

Django speaking WFS 2.0 to expose geo data
Mozilla Public License 2.0
38 stars 10 forks source link

Optimize GML rendering performance with 12%-27% #29

Closed vdboor closed 1 week ago

vdboor commented 1 week ago

This huge(!) diff rewrites the GML rendering to give better performance.

Writing 5000 records with 30 fields means some methods got called 150.000 times. Python isn't so good at handling that many method calls, so anything that reduced the number of calls clearly showed improvements.

A test with using lxml as writer actually turned out to be slower, not faster. This is likely due to the amount of namespace handling and additional Python-logic around the C-API calls that construct the object tree. In this project we already know exactly which strings need to be generated, which is hard to beat with a generic solution.

The following improvements were made using django-silk profiling to find hotspots:

A performance check with ab -n10 -c1 on BAG panden shows:

For AB#103331