Re: updateBackgroundColor mechanism is badly flawed

From: Joaquin Cuenca Abela (
Date: Mon Jul 29 2002 - 10:15:24 EDT

  • Next message: Joaquin Cuenca Abela: "Re: updateBackgroundColor mechanism is badly flawed"

    --- Tomas Frydrych <> wrote:
    > The updateBackgroundColor mechanism seems to be very
    > seriously
    > flawed and needs to be rewritten, as it is one of
    > the main bottlenecks
    > in the code.
    > The problem is this: the various calls to
    > updateBackgroundColor()
    > propagate down to the run level, where
    > fp_Run::updateBackgroundColor() querries the
    > PieceTable (!!!) for
    > the background colour property. This is not the way
    > it should be --
    > *the only* place the runs should ever querry the PT
    > for properties is
    > ::lookupProperties() which in turn is only to be
    > called in response to
    > formatting changes in the PT.
    > If the background colour needs to change because the
    > PT has
    > changed, then let it be done in ::_lookupProperties;
    > if the PT has not
    > changed, then the updateBackground colour has no
    > business of
    > querring the PT. So my question is why do we need
    > updateBackground() colour at all?

    I don't aim to reply such a transcendental question,
    but I have a fix to remove almost all the
    updateBackground() calls in my computer.

    Basically, we call it each time a run changes from one
    page to another one, and due to bumpContainers, that
    happens many times (remember the N^2/2 factor that I
    explained some time ago).

    I remove these calls (along with other superfluous
    calls) if we move a run from page a to page b, and
    page a and page b both have the same width and the
    same color. If that happens I not only cut
    updateBackground, but also some other
    fp_Line::setMaxWidthIDontRememberTheExactName stuff
    (that afair was also doing some fp_Run calls).

    That + a little cache in fp_Run to handle the obvious
    case where the new page changes the width, but keeps
    the same color removes all the superflous calls to

    I will try to sync my tree with cvs asap.

    Btw, can somebody please increase a bit the frecuency
    of the cvs snapshots? 1 day is a bit too long...


    Joaquin Cuenca Abela

    Do You Yahoo!?
    Yahoo! Health - Feel better, live better

    This archive was generated by hypermail 2.1.4 : Mon Jul 29 2002 - 10:21:54 EDT