commit: Cache doc position in Frags. Major piecetable speed ups.


Subject: commit: Cache doc position in Frags. Major piecetable speed ups.
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Thu Jun 07 2001 - 01:36:18 CDT


In this commit, I cache doc positions in the piecetable Fragments.

In addition I have implemented a vector of pointers to the Fragments.

This provides a major perforamnce improvements for large documents.

With this:

1. GetBounds() means just reading the last fragment, not itterating
through the whole document.

2. getPosFromStrux and getPosFromFrag means reading the frag associated
with the strux not itterating the entire fragment list to find the frag
strux with the doc position in it.

3. getStruxFromPos can now be performed with a binary search of the
Fragment pointers instead of itterating through the entire fragment list.

To keep the document sane I've carefully implemented the idea of
"dirtyFragments". Any operation which changes the size of the fragment
list or the size of a fragment sets a "dirtyFragment" boolean. Then any
operation which wants to do one the three things above must first clean
the fragments, basically itterating the document. This happens much less
frequently than those other three operations, which happen a lot.

The upshot of this is that AbiWord is now MUCH faster on large documents
and we can gracefully scale to the largest size docs people are likely to
use a WYSIWYG WP for.

I have verified this on 50 and 100 page documents against an
optimized v0.7.14. My debug build is MUCH faster.. Try it :-)

There are more speed ups I can do like caching the previously used page
class for scrolls and position searches. Right now we always start n the
first page and itterate through them all until we find a page on screen.

There is also a bug in fv_View right now that prevents you from scrolling
to the last page on a large document. I'll fix that soon.

Finally I've written a lot of code to fix the race condition(s) that cause
bug 119. However I've commented out some vital sections out until I've
fixed some remaining bugs. This is even harder than I thought. The top
ruler, the left ruler and textdrawing region set clipping reactangles that
they draw into. These can stomp on previously set rectangles
currently being drawn by a different part of the repainting code.

I'm confident I can fix all this though with judicous use of locks.

Cheers

Martin

----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS:
src/af/gr/unix/gr_UnixGraphics.cpp CVS:
src/af/xap/unix/xap_UnixFrame.cpp src/af/xap/xp/xap_Frame.cpp CVS:
src/af/xap/xp/xap_Frame.h src/text/fmt/xp/fl_DocListener.cpp CVS:
src/text/fmt/xp/fl_Layout.cpp src/text/fmt/xp/fp_Column.cpp CVS:
src/text/fmt/xp/fp_Column.h src/text/fmt/xp/fv_View.cpp CVS:
src/text/ptbl/xp/pd_Document.cpp src/text/ptbl/xp/pf_Frag.cpp CVS:
src/text/ptbl/xp/pf_Frag.h src/text/ptbl/xp/pf_Frag_Text.cpp CVS:
src/text/ptbl/xp/pf_Fragments.cpp CVS: src/text/ptbl/xp/pf_Fragments.h
CVS: src/text/ptbl/xp/pt_PieceTable.cpp CVS:
src/text/ptbl/xp/pt_PieceTable.h src/wp/ap/xp/ap_LeftRuler.cpp CVS:
src/wp/ap/xp/ap_TopRuler.cpp CVS:
----------------------------------------------------------------------



This archive was generated by hypermail 2b25 : Thu Jun 07 2001 - 01:36:37 CDT