Hello,
On windows with 1.4.0cvs on for big documents (ex: Extended.lyx), there
is a big delay (~1s) before a "Carriage Return" is shown on screen after
typing the "enter" key in the middle of a paragraph. The same will
happen when you type "Backspace" at the beginning of a paragraph. On the
contrary, if you type Ctrl-Z immediately after, the screen update is
instantaneous.
For both keys, 1.3.7pre is very quick.
I am trying to investigate if I could speed-up this a bit because this
is very, very irritating. I found that the big delay is in
"LyXText::breakParagraph" and more precisely in "::breakParagraph",
paragraph_funcs.C:97. The time consuming operation is the insertion of a
new paragraph inside the ParagraphList which is in fact a std::vector :
ParagraphList::iterator tmp =
pars.insert(pars.begin() + par_offset + 1, Paragraph());
I have compiled this file with -O3 but the slowness is still there.
Indeed insertion inside a vector is known to be inefficient. I have read
the history about ParagraphList_fwd.h
(http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel/src/ParagraphList_fwd.h)
and I guess there might be some valid reason to choose a vector instead
of a list but performance wise, it shows, definitely. I have tried to
replace with a list but this won't compile because some source needs the
[] operator. I have also tried a deque and the results are a bit better.
The weird thing is that the slowness is not at the same place. Indeed,
within a "Standard" environment, the paragraph insertion at the
beginning seems to be very fast but the following operation is slowing
things down:
for (pos_type i = pos_end; i >= pos; --i)
par.eraseIntern(i);
Within a "List" environment, the behavior is the same as with a vector
based class: the slowness is in the paragraph insertion at the beginning.
But I don't know if this is safe, so my question is: is there any
assumption in the code that the ParagraphList use a contiguous memory?
Deque does not... But "Extended.lyx" loads fine and all seems correct
(math, table, etc...).
I think a better solution would be to use a map or maybe a vector of
pointer.
Like it is now, IMHO, lyx-1.4 is close to unusable under window. Is
there some unofficial patch that would speed up things a bit?
Thanks,
Abdel.