Skip to content
Paged.

Professional publishing, beyond the desktop.

Resources / Journal

The journalFrom the WorkshopNo. 03

The first page is
composed first

Two engine changes of 14 November: pictures decoded at the size they are drawn, and the pages in view laid out before the rest. The engine says which pages are still provisional.

When the editor opened a document, the engine parsed the package, laid out every page, and only then answered. The first page of a large template waited for the composition of all the others. Two changes to the engine on 14 November attack that wait from both ends: the pictures, and the order of the work.

A picture at the size it is drawn

Placed pictures were decoded on every draw at the size the build recorded, up to 4,096 pixels: a page thumbnail 256 pixels wide decoded a full photograph to draw it 60 pixels wide, and kept nothing. The GPU path kept its own full-size copies, so a GPU session decoded every picture twice.

LevelsLevel k is the picture at 1/2k of its recorded size on both axes. A draw takes the deepest level that still covers it on the device, so a page at 400 percent gets every pixel.

Levels
Level k is the picture at 1/2k of its recorded size on both axes. A draw takes the deepest level that still covers it on the device, so a page at 400 percent gets every pixel.

Now each thread has one decoded-picture store, shared by the CPU tiles, the thumbnails and the GPU scenes. A draw asks for the picture at the level it needs; a JPEG is decoded at its DCT scale, an eighth, a quarter or a half, rather than at full size and then shrunk. The store holds at most 256 MiB and lets go of the pictures drawn longest ago. Exports, the command line and the fidelity checks are untouched: they still decode every pixel.

The pages in view, then the rest

The second change, protocol 84, lets the editor ask for some pages first. The engine builds a reduced document: the spreads holding those pages as they are, every other spread cut down to its bare pages, with nothing on them. The page list, sizes and labels are the whole document’s, and a story threaded in from an earlier spread brings that spread along, so its text arrives where it belongs. The worker then composes the pages in view first and the others after them, one step at a time, and the last step is the same whole-document build every edit runs.

What a provisional page cannot know, it does not pretend to.

Engine ADR 1314

Until that last step the document is provisional, and says so. A running header, a cross-reference’s page number or a table of contents may not match the final document on a page composed early, so the loading status reads “Composing pages · 3 of 12 · provisional”, and pages not yet composed are outlined, never drawn. Any edit ends the provisional state. A test loads twelve generated documents from the first, last and middle page, steps each to the end, and compares every page with the same document loaded whole.

What it measured

On a 54 MB template with thirty embedded photographs, measured on one machine under load the same day, the worker’s first paint came 6.3 seconds after the layout before both changes, 4.4 seconds with the picture store, and 3.7 seconds with the first page composed first. From the moment the file was chosen, the picture store took the first visible page from 17.0 to 10.7 seconds; composing the first page first did not move that measure beyond its noise. What remains is mostly the parse of the package and the first GPU present of a page of photographs. Hosts that do not ask for first pages, such as the command line, the server and scripts, load as before.

Sources

View the 7 sources for this article

Commits

Decisions

Documentation

Tests

paged.media, From the WorkshopThe first page is composed first,

Searchpaged.media, Docs and IDML

Esc