Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
| I used sometime yesterday evening to run gprof with large tables, and
| came up with the following patch. I posted it here instead of applying
| because it seems so obvious that I suspect I may have misunderstood
| something.
|
| The two main problems are:
|
| - InsetTabular::clone() duplicates its LyXTabular twice
yes, your change should be good.
| - Paragraph::Paragraph(const &Paragraph) all in all builds three
| ParagraphParameters instances, whereas none is needed, since the
| whole point of share_ptr IMO is reference counting.
What share_ptr?
You mean the one inside the SharedContainer.
No, you can't just use the default copy contructor. Or... let me think
a second. Actually you can... but then the SharedContainer might come
out of sync..... no you are right.
| Also, somethig that shows up in gprof output is insettext::getLyXText.
| Why the hell does this function use a map?? I understand that maps are
| constant time, but did you ever wondered how many entries are there?
Maps are not contant time they are O(log n).
(hashed maps otoh...)
| For now I would say 1, in the future certainly less that 10. I really
| doubt that a map will ever be faster than a list or whatever. Further,
| why do we pass a BufferView* to most insettext methods, whereas most
| of the times it just calls TEXT(bv)? Why not have the LyXText as
| parameter?
A simple assiative map implemented with std::vector<std::pair<X, Y> >
would probably be just as good. Would be nice to keep the std::map
interface though.
| diff -ur -x Makefile.in -x ext_l10n.h lyx-devel.orig/src/paragraph.C
|lyx-devel/src/paragraph.C
| --- lyx-devel.orig/src/paragraph.C Thu Jun 28 12:53:31 2001
| +++ lyx-devel/src/paragraph.C Fri Jun 29 00:01:40 2001
| @@ -115,9 +115,10 @@
| itemdepth = 0;
| next_ = 0;
| previous_ = 0;
| - clear();
| + //clear();
|
| - makeSameLayout(&lp);
| + layout = lp.layout;
You probably do not need this as it is done two lines below also...
| + //makeSameLayout(&lp);
|
| // this is because of the dummy layout of the paragraphs that
| // follow footnotes
| @@ -921,10 +922,11 @@
| void Paragraph::makeSameLayout(Paragraph const * par)
| {
| layout = par->layout;
| - params().makeSame(par->params());
| + //params().makeSame(par->params());
| + params() = par->params();
|
| // This can be changed after NEW_INSETS is in effect. (Lgb)
| - setLabelWidthString(par->params().labelWidthString());
| + //setLabelWidthString(par->params().labelWidthString());
| }
|
|
| diff -ur -x Makefile.in -x ext_l10n.h lyx-devel.orig/src/paragraph_pimpl.C
|lyx-devel/src/paragraph_pimpl.C
| --- lyx-devel.orig/src/paragraph_pimpl.C Thu Jun 28 14:56:17 2001
| +++ lyx-devel/src/paragraph_pimpl.C Fri Jun 29 00:12:53 2001
| @@ -40,7 +40,7 @@
|
|
| Paragraph::Pimpl::Pimpl(Paragraph::Pimpl const & p, Paragraph * owner)
| - : owner_(owner)
| + : params(p.params), owner_(owner)
| {
| inset_owner = p.inset_owner;
| text = p.text;
|
I am testing your patch now, with a couple of minor changes.
--
Lgb