7.13.15 The accumulating state

Prev Up Next Page 257 of 800 Search internet

The 'accumulating state' or 'rendering cache' is passed around rather than just being passed down. Rendering of a subtree is supposed to return a pair of form R :: C where R is the rendering of the subtree and C is a new accumulating state.

Rendering of a subtree takes a term t and a rendering state f :: C :: V as input and delivers a rendering R and a new accumulating state C as output. If rendering of a subtree has nothing to add to the accumulating state, it should just return the accumulating state unchanged.

The accumulating state is used for speeding up rendering. It takes time to render a construct because the renderer may have to look up the tex use, tex show, and name aspects of the construct and may have to do some processing of the data. The time spent on that adds up because rendering requires each and every construct of a page to be rendered.

Macro expansion is less demanding because most constructs have no macro definition which is fast to handle. That explains why the default renderer uses an accumulating state and the macro engine from the base page does not.

To speed up rendering of a construct, the rendering is split into two parts. The first part takes some time but only needs to be done once for each construct. The second part is faster but needs to be done once for each instance of each construct. We shall refer to the first of the two processes as 'rendering compilation'. The result of rendering compilation is accumulated in the accumulating state.

Prev Up Next Page 257 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05