3

I always thought that PDFs and PostScript files are quite similar, even though PostScript is a turing complete language.

Is there a reason PostScript is a lot slower when rendering (tried with evince on Ubuntu) than PDF or are the reader just a lot less optimized?

4 Answers 4

3

I've no way to currently check if my assumption is correct -- but here it goes anyway:

I suspect that evince cannot directly render and display PostScript on screen. Maybe it can only do so for PDF. So it may use a trick for PostScript files: behind you back it converts them to a temporary PDF file and display that one instead.

Try to install the (very old-fashioned) gv PostScript viewer on Ubuntu:

 sudo apt-get install gv

and then

 gv /path/to/PostScript.ps

and see if it is any faster. (gv also uses PostScript for rendering, but doesn't convert to PDF.) Or you use Ghostscript directly

 gs /path/to/PostScript.ps

But don't forget one thing: exactly because PostScript is a programming language, you can design PostScript files which are rather short in Bytes, but make the interpreter go through a loop with thousands of iterations (for example to compute + render a fractal) before it displays the file content on screen.

PDF doesn't have 'loops' and computations like that...

2
  • 1
    Here's a fractal in PS, which contains an infinite loop producing endless pdf pages. 3.1K produces 10's of Megabytes per page (too much for my Kindle). Sep 14, 2013 at 7:11
  • Speaking of postscript being a programming language where you can create files that are small in bytes but "large" in output, have a look at this mindblowing example of what's possible.
    – hlovdal
    Sep 11, 2023 at 9:27
1

But most importantly, PDF works page-wise: each page is mostly a self-contained entity, so you can skip to any page and the reader can start rendering that page immediately.

A PostScript document, instead, is a single big program, which means that the PS viewer has to execute it all the way to the page you want before being able to display it correctly.

Also, PDFs contain objects to be rendered, while PostScript is a programming language that instructs a renderer to draw such objects, thus PDF is, in some sense, pre-digested compared to PS, and thus quicker to interpret.

1

PostScript is a programming language.

PDF is a document format.

Because PostScript is a programming language, the entire contents of the document must be computed step by step. While PDF supports a limited subset of PostScript for vector graphics, it is designed specifically as a document format and does not require this sort of computation.

1

It depends on the PostScript code. One could write a 3D rendering algorithm in PostScript and use embedded AutoCAD files as pictures. It will take much time to render while PDF will contain prerasterized images. In some cases PostScript will be much faster to render. Unfortunately most popular publishing software emits very inefficient PostScript code. But converters PS->PDF are able to optimize their output for fast rendering.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .