Re: patch -- cache last searched frag


Subject: Re: patch -- cache last searched frag
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Fri Jul 06 2001 - 10:32:16 CDT


On Fri, 6 Jul 2001, [ISO-8859-1] Joaquín Cuenca Abela wrote:

> On 07 Jul 2001 00:51:49 +1000, Martin Sevior wrote:
> >
> >
> > On Fri, 6 Jul 2001, Hubert Figuiere wrote:
> >
> > > According to Joaquín Cuenca Abela <cuenca@pacaterie.u-psud.fr>:
> > >
> > > > Anyway, I will ask to *not* yet commit this patch. I've only tested it
> > > > slightly, and I've not yet been able to run a profiler in both,
> > > > precached-abiword and cached-abiword. So please, hold your breath until
> > > > I run a profiler and some more tests. And feel free to help with the
> > > > tests! :-)
> > >
> > > Actually I commit it as per dom's request. This is the best way to get it
> > > tested.
> > > CVS: src/af/xap/xp/xad_Document.cpp src/text/fmt/xp/fv_View.h
> > > CVS: src/text/ptbl/xp/pf_Frag.h src/text/ptbl/xp/pf_Fragments.cpp
> > > CVS: src/text/ptbl/xp/pf_Fragments.h
> > > CVS: src/text/ptbl/xp/pt_PieceTable.cpp
> > >
> >
> > Sh*t!! Please put the areFragsClean() test into it. Sorry it is hard for
> > me to work on the current sources now.
> >
> > I'm certain it will work with the areFragClean() method. I'm not certain
> > it will work without it.
>
> I'm pretty confident (but not 100% sure, let's say 90% sure) that it
> works *without* checking the areFragClean() method.
>

You might be right.

> In the findFirstFragBeforePos() (where the cache is confined), the
> binary search without the cache is based in correct values for the "pos"
> stored in each frag (values that may be false if the frag's vector is
> dirty).
>

Ahh... right. I misunderstood. Yes it should be 100% safe. That
function is only called if the Frags are clean. Leave the code
in place.

However just to be safe, put in the

UT_ASSERT(areFragsClean())

at the top of the findFirstFragBeforePos(..) method.

Great Work :-)

Cheers

Martin



This archive was generated by hypermail 2b25 : Fri Jul 06 2001 - 10:32:29 CDT