Jesper Larsen wrote: > Hi Matplotlib users, > > I have an application which produces PNG files using the AGG backend. > When I profile the application I can see that much of the cpu time is > spent in the method write_png called by print_figure in backend_agg.py.
I have seen this myself. Keep in mind that timing includes a lot of disk I/O, so if your images are particularly large, or you're saving to a network or external disk, or if another process steps in at that moment and wants to read/write to the disk, that could be the bottleneck, more so than just the CPU time spent doing the PNG compression. On any reasonably modern PC, I suspect that's the case. > Does anyone know which backend is the best for producing fast good > quality PNG files (with fast being as important as good quality)? They should all be approximately the same wrt actually writing out the file -- they're all using libpng either directly or indirectly. It also means there's not much that matplotlib can do to improve its performance, short of submitting patches to libpng -- but I suspect there isn't a lot of long-hanging fruit left to improve in such a widely-used library. > In another thread I read that antialiasing could be disabled for better > performance. I tried doing that in each call to contourf and it resulted > in a performance improvement. Does anyone have other performance tips > with regard to PNG files? Saving to a Python file-like object (if you're doing that) is slower than saving directly to a file path. See the recent thread on "Matplotlib performance" for a discussion of decimation of data (if your data set is really large). Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users