On Thu, Mar 18, 2004 at 04:53:44PM +0000, John Levon wrote: > As I recall you have a fast machine. Can we get some actual metrics on > how much slower it is ? You might not notice 10%, but it's a big deal > for others
Startup plus loading the UserGuide plus 20 breaks of the initial paragraph are 0.5s for the list based version on a AMD Athlon(TM) XP1700+ 0.75s for the list based version on a AMD Athlon(TM) XP1700+ Startup plus loading the UserGuide alone is 0.22s So the list based version is about a factor 2 slower than the vector based. However, each operation is < 0.03 seconds, so it should not matter even for a PI 166 or so. (Should be < .2 s there) [I am a bit surprised by these numbers myself. Startup seems to be really quick nowadays!] Some data points: List: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 8.00 0.04 0.04 101085 0.00 0.00 __gnu_cxx::__normal_iterator<boost::shared_ptr<ParameterStruct>*, std::vector<boost::shared_ptr<ParameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > > std::find_if<__gnu_cxx::__normal_iterator<boost::shared_ptr<ParameterStruct>*, std::vector<boost::shared_ptr<Par ameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > >, ShareContainer<ParameterStruct>::isEqual>(__gnu_cxx::__normal_iterator<boost::shared_ptr<Paramet erStruct>*, std::vector<boost::shared_ptr<ParameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > >, __gnu_cxx::__normal_iterator<boost::shared_ptr<Para meterStruct>*, std::vector<boost::shared_ptr<ParameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > >, ShareContainer<ParameterStruct>::isEqual, std::r andom_access_iterator_tag) 6.00 0.07 0.03 2164881 0.00 0.00 Paragraph::getChar(int) const 6.00 0.10 0.03 23961 0.00 0.01 LyXText::setCounter(Buffer const&, std::_List_iterator<Paragraph, Paragraph&, Paragraph*>) 6.00 0.13 0.03 5103 0.01 0.01 LyXText::setRowWidth(std::_List_iterator<Paragraph, Paragraph&, Paragraph*>, Row&) const 4.00 0.15 0.02 2164881 0.00 0.00 std::vector<char, std::allocator<char> >::operator[](unsigned int) const 4.00 0.17 0.02 527525 0.00 0.00 FontIterator::operator++() 4.00 0.19 0.02 176487 0.00 0.00 Paragraph::setFont(int, LyXFont const&) 4.00 0.21 0.02 120 0.17 0.17 std::list<Paragraph, std::allocator<Paragraph> >::size() const 2.00 0.22 0.01 3554610 0.00 0.00 Spacing::getValue() const 2.00 0.23 0.01 1227367 0.00 0.00 LyXFont::realShape() const 2.00 0.24 0.01 1159179 0.00 0.00 LyXFont::language() const 2.00 0.25 0.01 814589 0.00 0.00 Paragraph::isInset(int) const 2.00 0.26 0.01 584566 0.00 0.00 font_metrics::width(char const*, unsigned int, LyXFont const&) 2.00 0.27 0.01 561664 0.00 0.00 LyXText::singleWidth(std::_List_iterator<Paragraph, Paragraph&, Paragraph*>, int, char, LyXFont const&) const [...] ----------------------------------------------- 0.00 0.00 20/20 LyXText::breakParagraph(LCursor&, char) [14] [146] 0.3 0.00 0.00 20 breakParagraph(BufferParams ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ const&, std::list<Paragraph, std::allocator<Paragraph> >&, std::_List_iterator<Paragraph, Parag raph&, Paragraph*>, int, int) [146] 0.00 0.00 3346/3346 (anonymous namespace)::moveItem(Paragraph&, Paragraph&, BufferParams const&, int, int) [158] 0.00 0.00 3346/3347 Paragraph::Pimpl::eraseIntern(int) [244] 0.00 0.00 20/2499 Paragraph::Paragraph() [72] 0.00 0.00 20/35 ParagraphParameters::align(LyXAlignment) [341] 0.00 0.00 20/22441 ParagraphParameters::labelWidthString(std::string const&) [70] 0.00 0.00 20/1794 ParagraphParameters::depth(unsigned int) [161] 0.00 0.00 20/24 ParagraphParameters::noindent(bool) [362] 0.00 0.00 15/2514 ParagraphParameters::clear() [153] 0.00 0.00 20/5856 Paragraph::~Paragraph() <cycle 4> [730] 0.00 0.00 35/59752 BufferParams::getLyXTextClass() const [376] 0.00 0.00 10388/455826 std::_List_iterator<Paragraph, Paragraph&, Paragraph*>::operator->() const [593] 0.00 0.00 6692/7771 std::_List_iterator<Paragraph, Paragraph&, Paragraph*>::operator*() const [720] 0.00 0.00 3346/3346 Paragraph::eraseIntern(int) [813] 0.00 0.00 3346/3346 Paragraph::Pimpl::setChange(int, Change::Type) [814] 0.00 0.00 3346/3346 Paragraph::setChange(int, Change::Type) [815] 0.00 0.00 3346/121654 Paragraph::Pimpl::lookupChange(int) const [622] 0.00 0.00 3346/121654 Paragraph::lookupChange(int) const [621] 0.00 0.00 155/291215 Paragraph::params() [599] 0.00 0.00 55/2537 Paragraph::layout(boost::shared_ptr<LyXLayout> const&) [844] 0.00 0.00 35/19264 LyXTextClass::defaultLayout() const [675] 0.00 0.00 20/3903 std::list<Paragraph, std::allocator<Paragraph> >::insert(std::_List_iterator<Paragraph, Paragraph&, Paragraph*>, Paragr aph const&) [795] 0.00 0.00 20/4465 Paragraph::inInset() const [785] 0.00 0.00 20/2648 Paragraph::setInsetOwner(UpdatableInset*) [837] 0.00 0.00 20/40 Paragraph::allowEmpty() const [1960] 0.00 0.00 20/361348 Paragraph::layout() const [597] 0.00 0.00 20/16985 ParagraphParameters::align() const [681] 0.00 0.00 20/14621 ParagraphParameters::labelWidthString() const [688] 0.00 0.00 20/22364 Paragraph::setLabelWidthString(std::string const&) [661] 0.00 0.00 20/408741 ParagraphParameters::depth() const [595] 0.00 0.00 20/4095 ParagraphParameters::noindent() const [789] Vector based: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 13.24 0.09 0.09 96358 0.00 0.00 __gnu_cxx::__normal_iterator<boost::shared_ptr<ParameterStruct>*, std::vector<boost::shared_ptr<ParameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > > std::find_if<__gnu_cxx::__normal_iterator<boost::shared_ptr<ParameterStruct>*, std::vector<boost::shared_ptr<Par ameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > >, ShareContainer<ParameterStruct>::isEqual>(__gnu_cxx::__normal_iterator<boost::shared_ptr<Paramet erStruct>*, std::vector<boost::shared_ptr<ParameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > >, __gnu_cxx::__normal_iterator<boost::shared_ptr<Para meterStruct>*, std::vector<boost::shared_ptr<ParameterStruct>, std::allocator<boost::shared_ptr<ParameterStruct> > > >, ShareContainer<ParameterStruct>::isEqual, std::r andom_access_iterator_tag) 5.88 0.13 0.04 850157 0.00 0.00 font_metrics::width(char const*, unsigned int, LyXFont const&) 4.41 0.16 0.03 3306512 0.00 0.00 Spacing::getValue() const 4.41 0.19 0.03 3294143 0.00 0.00 Paragraph::getChar(int) const 4.41 0.22 0.03 1716129 0.00 0.00 LyXFont::language() const 4.41 0.25 0.03 816475 0.00 0.00 LyXText::singleWidth(__gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > > , int, char, LyXFont const&) const 4.41 0.28 0.03 231694 0.00 0.00 LyXText::getFont(__gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > >, in t) const 2.94 0.30 0.02 3294143 0.00 0.00 std::vector<char, std::allocator<char> >::operator[](unsigned int) const 2.94 0.32 0.02 22667 0.00 0.00 (anonymous namespace)::RowPainter::paintChars(int&, bool, bool) 2.94 0.34 0.02 5864 0.00 0.02 LyXText::rowBreakPoint(__gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > >, Row&) const 1.47 0.35 0.01 1786997 0.00 0.00 LyXFont::realShape() const 1.47 0.36 0.01 1573744 0.00 0.00 bool __gnu_cxx::operator!=<Paragraph::Pimpl::FontTable const*, std::vector<Paragraph::Pimpl::FontTable, std::alloc ator<Paragraph::Pimpl::FontTable> > >(__gnu_cxx::__normal_iterator<Paragraph::Pimpl::FontTable const*, >std::vector<Paragraph::Pimpl::FontTable, std::allocator<Paragraph ::Pimpl::FontTable> > > const&, __gnu_cxx::__normal_iterator<Paragraph::Pimpl::FontTable const*, std::vector<Paragraph::Pimpl::FontTable, std::allocator<Paragraph::Pimp l::FontTable> > > const&) 1.47 0.37 0.01 1563594 0.00 0.00 __gnu_cxx::__normal_iterator<Paragraph::Pimpl::FontTable const*, std::vector<Paragraph::Pimpl::FontTable, std::all ocator<Paragraph::Pimpl::FontTable> > >::operator->() const 1.47 0.38 0.01 745046 0.00 0.00 FontIterator::operator++() 1.47 0.39 0.01 602906 0.00 0.00 operator==(LyXFont::FontBits const&, LyXFont::FontBits const&) 1.47 0.40 0.01 565624 0.00 0.00 BufferView::buffer() const ----------------------------------------------- 0.00 0.38 19/19 LyXText::dispatch(LCursor&, FuncRequest&) [13] [14] 55.3 0.00 0.38 19 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LyXText::breakParagraph(LCursor&, char) [14] 0.01 0.34 19/20 LyXText::updateCounters() [15] 0.00 0.01 19/19 breakParagraph(BufferParams const&, std::vector<Paragraph, std::allocator<Paragraph> >&, __gnu_cxx::__normal_iterator<P aragraph*, std::vector<Paragraph, std::allocator<Paragraph> > >, int, int) [75] 0.00 0.01 38/38 LyXText::redoParagraph(__gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > >) [ 80] 0.00 0.00 38/738 LyXText::updateParPositions() [121] 0.00 0.00 19/44 LyXText::setCursor(LCursor&, int, int, bool, bool) [189] 0.00 0.00 51/111 DocumentIterator::lastpos() const [348] 0.00 0.00 19/19 LyXText::recUndo(int, int) const [375] 0.00 0.00 19/378874 Paragraph::isNewline(int) const [71] 0.00 0.00 19/19 LyXText::undoSpan(__gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > >) [379] 0.00 0.00 38/565624 BufferView::buffer() const [108] 0.00 0.00 19/300 DocumentIterator::paragraph() [317] 0.00 0.00 13/106 DocumentIterator::textRow() [350] 0.00 0.00 19/375866 Paragraph::isLineSeparator(int) const [127] 0.00 0.00 19/62466 BufferParams::getLyXTextClass() const [175] 0.00 0.00 3/3 Paragraph::erase(int) [426] 0.00 0.00 156/466 CursorSlice::pos() [1186] 0.00 0.00 76/164 CursorSlice::par() [1382] 0.00 0.00 38/888 LyXText::getPar(int) const [1018] 0.00 0.00 38/31460 LyXText::bv() [602] 0.00 0.00 38/305056 Buffer::params() [552] 0.00 0.00 38/665286 boost::shared_ptr<LyXLayout>::operator->() const [544] 0.00 0.00 19/474365 Paragraph::layout() const [549] 0.00 0.00 19/44 LyXText::parOffset(__gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > >) const [1926] 0.00 0.00 19/38 Paragraph::allowEmpty() const [1971] 0.00 0.00 19/92031 LyXText::paragraphs() const [577] 0.00 0.00 19/3030 __gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > > boost::next<__gnu_cxx::__ normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragraph> > > >(__gnu_cxx::__normal_iterator<Paragraph*, std::vector<Paragraph, std::allocator<Paragr aph> > >) [780] 0.00 0.00 13/13 Paragraph::isChangeEdited(int, int) const [2298] 0.00 0.00 13/68887 Row::pos() const [581] so the vector based version spends 55.3% of its time in breakParagraph whereas the list version uses just 0.3%. Sound a lot and the ratio was to be expected. However, the absolute numbers (<0.03s per user action) are just 'noise'. So, again: I'd like to switch to vector<Paragraph>. We get super stable super simple iterators this way, and it even makes the code simpler (no more LyXText::parOffset/getPar etc). Is this convincing evidence? Andre'