-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael Droettboom wrote: > 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.
This seems to contradict your previous assertion that the bottleneck is likely to be disk I/O - if you're saving to a Python file-like object, there's no disk I/O. Why is this slower? thanks, Dave [snip] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkfL/nwACgkQOP+t1LlaoiHOLACgs9OjjjP/g1MZW9QVW7N4i1CU bJ0An2tgdi+3bXL/gX2e+ZRAEswPgapw =nkGp -----END PGP SIGNATURE----- ------------------------------------------------------------------------- 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