How can I speed up a tricontourf call ?

Hello,
I'm working on this travel times project :

https://ubikiwi.com/ouhabiter?locations=[[48.85522811385678,2.332191467285156]]

and the contouring is done thanks to MPL tricontourf function (thanks!).
As you can see it works pretty well and is fast enough.

As I'm trying to expand the geographical coverage of the application (the
whole country) I'm having performance issues with the contouring:

- if I load the triangulation in memory at startup, it takes a huge amount
of RAM. But the real problem is that even a very small contour in this huge
triangulation takes a very long time to produce. For example with a small
triangulation, a 20 minutes walk isoline is instant. The same contour on a
country-wide triangulation takes 6sec. (It is not that long, but for a web
application it is).

- If on the other hand I compute a triangulation for each request, the
contouring is fast but the triangulation creation is slow.

Would someone have an optimisation idea ?
Is it somehow possible to speed up the triangulation ?
Any possible alternative ?

Thanks a lot,
Francis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160831/8348804d/attachment.html>

If you have the RAM for it I would look at something like image pyramids
https://en.wikipedia.org/wiki/Pyramid_(image_processing) + some LRU caching.

Tom

···

On Wed, Aug 31, 2016 at 1:08 PM Francis Chabouis <fchabouis at gmail.com> wrote:

Hello,
I'm working on this travel times project :

https://ubikiwi.com/ouhabiter?locations=[[48.85522811385678,2.332191467285156]]

and the contouring is done thanks to MPL tricontourf function (thanks!).
As you can see it works pretty well and is fast enough.

As I'm trying to expand the geographical coverage of the application (the
whole country) I'm having performance issues with the contouring:

- if I load the triangulation in memory at startup, it takes a huge amount
of RAM. But the real problem is that even a very small contour in this huge
triangulation takes a very long time to produce. For example with a small
triangulation, a 20 minutes walk isoline is instant. The same contour on a
country-wide triangulation takes 6sec. (It is not that long, but for a web
application it is).

- If on the other hand I compute a triangulation for each request, the
contouring is fast but the triangulation creation is slow.

Would someone have an optimisation idea ?
Is it somehow possible to speed up the triangulation ?
Any possible alternative ?

Thanks a lot,
Francis
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160901/c675e3de/attachment.html>

Hello Francis,

Normally to help with requests of this nature we would need to see your
code to identify if you are doing anything wrong, or at least sub-optimally.

Without seeing your code, we will at least need some more information.
We'll start with:
1) How big is your triangulation, i.e. how many points and how many
triangles?
2) How much is "a huge amount of RAM"?
3) How long is a "very long time to produce"?
4) How much RAM do you have available?
5) Is the geometric triangulation static, i.e. constant in time?
6) Each time you create a matplotlib.tri.Triangulation object, do you
specify the triangles array or not (the latter meaning that a Delaunay
triangulation is calculated for you)?

Ian

···

On 31 August 2016 at 18:08, Francis Chabouis <fchabouis at gmail.com> wrote:

Hello,
I'm working on this travel times project :

https://ubikiwi.com/ouhabiter?locations=[[48.85522811385678,
2.332191467285156]]

and the contouring is done thanks to MPL tricontourf function (thanks!).
As you can see it works pretty well and is fast enough.

As I'm trying to expand the geographical coverage of the application (the
whole country) I'm having performance issues with the contouring:

- if I load the triangulation in memory at startup, it takes a huge amount
of RAM. But the real problem is that even a very small contour in this huge
triangulation takes a very long time to produce. For example with a small
triangulation, a 20 minutes walk isoline is instant. The same contour on a
country-wide triangulation takes 6sec. (It is not that long, but for a web
application it is).

- If on the other hand I compute a triangulation for each request, the
contouring is fast but the triangulation creation is slow.

Would someone have an optimisation idea ?
Is it somehow possible to speed up the triangulation ?
Any possible alternative ?

Thanks a lot,
Francis

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160915/60812989/attachment.html>