Doing lyx -x lyx-quit big.lyx, the attached patch gives the following results (warm cache, error around 4%) : user (s) | sys (s) | elapsed (s) | ---------------------------------------------------------------------- 28.33 (0.00%) | 0.30 (0.00%) | 29.61 (0.00%) | newinsetsold 24.29 (-14.27%) | 0.32 (6.61%) | 25.92 (-12.48%) | newinsetsnew and the binary is only 14k bigger (with -g -O). This seems worth it to me. The top of the profile looks like this with the patch applied : LyXParagraph::InsertChar(int, char, LyXFont const &)[0x08146e5c]: 1.0553% (10233 samples) LyXParagraph::GetChar(int) const[0x08148210]: 1.1648% (11295 samples) basic_string<...>::compare(char const *, unsigned int, unsigned int) const[0x08288a38]: 1.3048% (12652 samples) LyXText::GetFont(Buffer const *, LyXParagraph *, int) const[0x08173358]: 1.4893% (14441 samples) LyXFont::FontBits::eq(LyXFont::FontBits const &) const[0x081110f4]: 1.5215% (14753 samples) LyXFont::realize(LyXFont const &)[0x08111af0]: 1.5622% (15148 samples) boost::shared_ptr<LyXFont> * find_if<boost::shared_ptr<LyXFont> *, ShareContainer<LyXFont>::isEqual>(boost::shared_ptr<LyXFont> *, boost::shared_ptr<LyXFont> *, ShareContainer<LyXFont>::isEqual, random_access_iterator_tag)[0x082d5dc0]: 1.6546% (16044 samples) Buffer::parseSingleLyXformat2Token(LyXLex &, LyXParagraph *&, LyXParagraph *&, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &, int &, char &, LyXFont &)[0x080a45d4]: 1.8889% (18316 samples) __7LyXFont[0x08111170]: 2.3485% (22772 samples) LyXParagraph::GetFontSettings(BufferParams const &, int) const[0x0814750c]: 3.3957% (32927 samples) LyXText::GetRow(LyXParagraph *, int, int &) const[0x08172b40]: 63.7895% (618541 samples) thanks john -- "24-hour boredom I'm convicted instantly" - Manic Street Preachers
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.95 diff -u -p -r1.95 ChangeLog --- src/ChangeLog 2001/03/15 10:06:52 1.95 +++ src/ChangeLog 2001/03/15 11:53:15 @@ -1,3 +1,10 @@ +2001-03-15 John Levon <[EMAIL PROTECTED]> + + * lyxrow.h: + * lyxrow.C: inline some get() accessors. This + adds about 14k to the binary but speeds up a + large file load by about 10%. + 2001-03-14 Angus Leeming <[EMAIL PROTECTED]> * lyxfunc.C (Dispatch): removed redundant break statement. Index: src/lyxrow.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow.C,v retrieving revision 1.4 diff -u -p -r1.4 lyxrow.C --- src/lyxrow.C 2000/07/24 13:53:17 1.4 +++ src/lyxrow.C 2001/03/15 11:53:15 @@ -29,30 +29,12 @@ void Row::par(LyXParagraph * p) } -LyXParagraph * Row::par() -{ - return par_; -} - - -LyXParagraph * Row::par() const -{ - return par_; -} - - void Row::pos(LyXParagraph::size_type p) { pos_ = p; } -LyXParagraph::size_type Row::pos() const -{ - return pos_; -} - - void Row::fill(int f) { fill_ = f; @@ -71,24 +53,12 @@ void Row::height(unsigned short h) } -unsigned short Row::height() const -{ - return height_; -} - - void Row::width(unsigned int w) { width_ = w; } -unsigned int Row::width() const -{ - return width_; -} - - void Row::ascent_of_text(unsigned short a) { ascent_of_text_ = a; @@ -119,19 +89,7 @@ void Row::next(Row * r) } -Row * Row::next() const -{ - return next_; -} - - void Row::previous(Row * r) { previous_ = r; -} - - -Row * Row::previous() const -{ - return previous_; } Index: src/lyxrow.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow.h,v retrieving revision 1.10 diff -u -p -r1.10 lyxrow.h --- src/lyxrow.h 2000/07/24 13:53:17 1.10 +++ src/lyxrow.h 2001/03/15 11:53:15 @@ -26,13 +26,13 @@ public: /// void par(LyXParagraph * p); /// - LyXParagraph * par(); + inline LyXParagraph * par(); /// - LyXParagraph * par() const; + inline LyXParagraph * par() const; /// void pos(LyXParagraph::size_type p); /// - LyXParagraph::size_type pos() const; + inline LyXParagraph::size_type pos() const; /// void fill(int f); /// @@ -40,11 +40,11 @@ public: /// void height(unsigned short h); /// - unsigned short height() const; + inline unsigned short height() const; /// void width(unsigned int w); /// - unsigned int width() const; + inline unsigned int width() const; /// void ascent_of_text(unsigned short a); /// @@ -56,11 +56,11 @@ public: /// void next(Row * r); /// - Row * next() const; + inline Row * next() const; /// void previous(Row * r); /// - Row * previous() const; + inline Row * previous() const; private: /// LyXParagraph * par_; @@ -83,4 +83,44 @@ private: Row * previous_; }; +inline LyXParagraph * Row::par() +{ + return par_; +} + + +inline LyXParagraph * Row::par() const +{ + return par_; +} + + +inline LyXParagraph::size_type Row::pos() const +{ + return pos_; +} + + +inline unsigned short Row::height() const +{ + return height_; +} + + +inline unsigned int Row::width() const +{ + return width_; +} + + +inline Row * Row::next() const +{ + return next_; +} + + +inline Row * Row::previous() const +{ + return previous_; +} #endif