On Aug 23, 2006, at 21:59, Andreas L Delmelle wrote:
<snip />
The other consideration, but that would be for a more distant
future, is to be able to have three different threads:
- fo creation (a)
- base layoutengine initialization (b)
- actual breaking/layout (c)
A bit more elaboration:
This could actually be done in a single thread, chopping the process
up into discrete parts, and bouncing control from (a) to (b) to (c)
and back.
Implementing this with multiple threads would be much trickier, since
the access to all the lists needs to be synchronized.
The main difference between total-fit and first-fit would be as to
how far all the lists ultimately grow. Even then, suppose that we
have computed the possible breaks for the first ten pages, what is
the probability that even a total-fit algorithm would need to revisit
the scores?
The direction I'm thinking in, lies somewhere between first- and
total-fit. For relatively short sequences --say 20 pages max.-- FOP's
default behavior would offer the same result as a real total-fit.
What we also have to keep in mind, though, is the possibility of
arbitrarily large sequences. An unconditional total-fit might become
next to impossible to deal with for systems with average memory specs.
I'm thinking this could be controlled by a configuration option: the
maximum number of pages that is considered before the finishing part
of the layout phase is triggered.
A threshold of zero would mean that the areas are added immediately
upon reaching the first break --literal first-fit-- and there is
neither a need nor a possibility to revisit the breaks on earlier
pages. Setting this threshold to say 500, would make sure that one
always achieves the best possible layout for 500 subsequent pages,
provided that memory constraints allow it.
Just so as not to confuse a total-fit algorithm with performing
everything in one big loop. While the needed context is much larger,
it still can be gathered piece-by-piece. Only, certain decisions need
to be deferred until the complete/total context is known.
The important part is that the opportunity would be opened for any
type of algorithm to release parts of the FOTree and the layout tree
earlier, by constraining the window to a maximum number of pages.
The question is whether the base element list creation could be
considered a part of the layout-initialization process, or whether it
belongs in the actual layout phase. Auto-layout for tables is one
particular area where it may prove interesting to consider the base
element list creation as a preparatory step rather than as a part of
the layout process itself.
Maybe there are others?
Later,
Andreas