pstest.py makes invalid PS, patch for backend_ps

Hi all,

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?

Best,

f

backend_ps.diff (6.2 KB)

Hello Fernando,

The diff is attached against CVS, I
don't want to commit anything like this wihtout a bit of review/test from
others.

I had a look at the diff and it looks fine for me.
But I did not apply the patch to run any test cases.

Is there a set of tests I can use to check against, other than the
examples/ dir?

Usually I use the backend_driver.py script in the examples subdirectory
to run matplotlib on loads of examples and look at the generated output.
This also measures execution times, so you can check how big the speed
gain is. (If you check please post the result, I'm curious.)

Thanks for your help,
Jochen

···

On Mon, Feb 07, 2005 at 05:33:54PM -0700, Fernando Perez wrote:
--

???

The pstest.py script uses nothing dangerous looking and gv processes
the output fine for me. Does your gv literally crash or just emit an
error message for the generated PostScript?

All the best,
Jochen

···

On Mon, Feb 07, 2005 at 05:33:54PM -0700, Fernando Perez wrote:

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.

--

Jochen Voss wrote:

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.

???

The pstest.py script uses nothing dangerous looking and gv processes
the output fine for me. Does your gv literally crash or just emit an
error message for the generated PostScript?

gv opens fine, it's just that the gs interpreter dies:

Error: /typecheckGNU Ghostscript 7.07: Unrecoverable error, exit code 1
  in --.setlinejoin--
Operand stack:
    0.0
Execution stack:
    %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- 1 5 %oparray_pop --nostringval-- --nostringval--
Dictionary st
Error: PostScript interpreter failed in main window.

So I get a blank gv window. This is with current CVS (without my patch), so I'm afraid to do anything with my patch until I can have again a working mpl.

Any ideas?

f

···

On Mon, Feb 07, 2005 at 05:33:54PM -0700, Fernando Perez wrote:

Fernando Perez wrote:

Jochen Voss wrote:

The pstest.py script uses nothing dangerous looking and gv processes
the output fine for me. Does your gv literally crash or just emit an
error message for the generated PostScript?

OK, I can confirm that the problem is in backend_ps in CVS. I backed off _just that file_ to the one in 0.71, and it works. So PS generation seems to be broken in CVS, for all I can tell.

Sorry but I can't track this down further right now.

Best,

f