Andre Poenitz wrote:

> 
> But maybe time for some comments on the last of todays patches (the one
> I won't apply).
> 
> This is changing ParagraphList to a std::vector<Paragraph>.

Man, where do you get all that energy? ;-)
 
> After playing around a bit I am convinced this is the way to go. First
> of all, there is really no performance problem withit whatsoever. E.g.
> splitting the first paragraph of the UserGuide.lyx leads to no
> recognizable delay although it moves all the contents of the document.
> 
> You can check this yourself by changing the typedef and commenting out
> the 'splice' line in CutAndPaste.C which seemingly is the only time we
> use a std::list specific feature.

I would expect big time improvements once the getPar stuff dies. This
doesn't necesarily is an argument in favour. (rather against paroffsets
everywhere)

> Secondly, it gives us a trivial 'stable iterator' implementation.  In
> fact, I even think we get drop the DocumentIterator::inset_ 'cache' as
> recreating this is O(nesting level) with the vector<> based par list,
> i.e. effectively O(1) on real world documents.

Not counting the insetlist stuff yes, but I agree.

> You will notice, however, that after changing the typedef things go
> foobar for 'complex' operations. So we seem to rely on the fact that
> list iterators are 'semi-stable' (compared to vector iterators) under
> deletion/insertion.
> 
> The easy way out is of course, to use offsets everywhere, and this is
> what patch 8 does. I am not done with it. Although most changes are
> purely mechanical, some are not.
> 
> I also think this it is a good idea to let everybody getting used to the
> idea of a vector based paragraph list.

Sigh.
 
> PS: A rule of thumb I came up with during the 'playing around': O(n)
> is acceptable anywhere anytime as response to a user interaction. O(n^2)
> is not. With the vector based solution we never get worse then O(n),
> for list based this is tricky (if possible at all).

I don't know if I agree with you here. This is like this because of the
getPar stuff, that is really needed only when moving paragraphs around
(i.e. c&p, undo) but is used everywhere.

In any case, I'm not really against the move. If only we could get more
people fixing cvs, it wouldn't be unwise. Right now, I don't know.

Alfredo


Reply via email to