On Fri 10 Sep 2021 at 13:52:04 (-0700), H. S. Teoh wrote: > On Fri, Sep 10, 2021 at 09:52:09PM +0200, Jean Abou Samra wrote: > > Le 10/09/2021 à 19:09, H. S. Teoh a écrit : > > > OK, I attached a contrived .ly file that produces 2 pages of music > > > (the effect is most noticeable when there's more than 1 page), and > > > two .pdf's, one compiled by the official Debian lilypond package > > > (2.22.1), and one by my local lilypond build (latest git master). > > > > > > The second file (test-bad.pdf) is noticeably slower to view on a PDF > > > viewer; this is especially noticeable when flipping between pages. > > > Whereas the first one (test-good.pdf) renders quickly and pages > > > quickly. > > > > What is your PDF reader? With all of Evince, > > Okular and Firefox's built-in PDF reader on my > > Ubuntu system, both files render fast enough and > > I cannot see a noticeable difference. > [...] > > I'm using GV, which shows noticeably slowdown. I tested again with > Evince; the slowdown is still there but only in a more complex score. > With the contrived score I posted it's not really noticeable. Also, > Evince appears to cache generated pages at startup: with a more complex > score there's a noticeable delay during startup, but thereafter about > 2-3 pages are cached, and the delay only happens when you scroll to an > uncached page. With 2.22.1, there is no such slowdown. > > Since PDF reader performance seems an unreliable measure of this issue, > here's another one: running pdf2ps and then ps2pdf on the 2.22.1 score > produces a compressed score (well, sometimes it doesn't compress well > but the resulting file size is comparable to the original). But on git > master, both pdf2ps and ps2pdf take a very long time to run, and produce > a .ps and second .pdf about 10x the size of the original file. > > Something about the .pdf produced by (my build of) git master causes > these tools to behave an in unusual way, and I want to find out why, and > whether it's something caused by lilypond itself, or by some build > misconfiguration on my part.
I've had a comment in my .bashrc file for years reminding me never to use pdf2ps, but pdftops instead (comes with poppler). I think pdf2ps might be suitable for the final rendering step in, say, CUPS. I did run your test on test-good.pdf, using Debian buster: 109532 test-good.pdf →pdf2ps→ 230847 good2.ps →ps2pdf→ 28144 good2.pdf 109532 test-good.pdf →pdftops→ 100040 goodto.ps →ps2pdf→ 19427 goodto.pdf 2000% screenshots attached. Cheers, David.