>>>>> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes:

Andre> On Wed, May 29, 2002 at 04:53:56PM +0200, Jean-Marc Lasgouttes
Andre> wrote:
>> It should. Note that there is a lot of time needed to load the
>> fonts from the X server that gprof does not take in account. I
>> tried to install the gprof-aware libc packages, but I do not know
>> how to use this.

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 :).

Something like
bool operator==(string const &s1, string const &s2) {
  return s1.size() == s2.size() 
         && !strncmp(s1.data(), s2.data(), s1.size());
}
Or even checking whether s1.srep == s2.srep (it would be easy to have
most layout strings be shared instances).

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.

JMarc

Reply via email to