I went through backend_ps picking out the low-hanging fruit. O(N^2) stuff, string += concatenations, unnecessary copies, stuff like that. Here's a patch. I tested it on a few small things and didn't really see much difference, so it would be good if you have a nasty PS to make (something with many thousands of line calls). The diff is attached against CVS, I don't want to commit anything like this wihtout a bit of review/test from others.
In trying to test it, I also ran the supplied pstest.py in examples/, after uncommenting the savefig() call. I noticed the generated postscript crashes gv. This is not good. I tested this bad-PS corruption both with my patch and with unmodified backend_ps, and it happens in both cases. I don't really know what it could be.
Is there a set of tests I can use to check against, other than the examples/ dir?
backend_ps.diff (6.2 KB)