On Wed, May 29, 2002 at 05:19:08PM +0200, Jean-Marc Lasgouttes wrote: > Andre> LyXTextClass::operator[] is pretty expensive. > > This is because of string comparisons which are done for the cached > value. I do not think we can go much faster, except if we used a > smarter operator== for strings (of course we can't, since we do not > have the right to use our own strings :).
Ok. I just tried a map. It does make things neither better nor worse... > Andre> I wonder if we should replace the layout vector by a map > Andre> indexed by the layout name... > > I am under the impression that most of the time spent is in line 524: > if (name == lastLayoutName) > return layoutlist[lastLayoutIndex]; > > You can't be much faster than that, if this is really the bottleneck. I think we have a right to use a "const_string" class... Apart from that: Why does a paragraph carry its layout as string and not as index in the layout table? Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)