Georg Baum wrote:
Abdelrazak Younes wrote:

Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes
<[EMAIL PROTECTED]> writes:
Abdelrazak> And got rid of this. So if this profile is correct, the
Abdelrazak> attached patch will save more than 8% time at file
Abdelrazak> reading. Could you try it out please Edwin?

This looks like a very big patch for such a result.
I said "at least 8%", I hope it will bring much more.

I would prefer to
avoid it if possible.

Me too. I don't really like the interface of LyXlex, but I think we should
try to get rid of the whole class during the XML change rather than
modifying it.

Most of the patch is mechanical (due to the lex API change).

That API change looks partly suspicious to me. I did only glance quickly
over the patch, but I don't like

int i = lex.getInt(str);

at all (from memory).

I think you misread something. In my patch, it's either:

int i = lex.readInteger();

or
lex.next(str);
int i = lex.toInteger(str);

Either you just want to convert str to an integer.
Then you should use

int i = convert<int>(str);

And that's exactly what toInt(str) does. The reason why it is a LyXLex member is that it does some checking and call LyXLex::printError() if needed:

int LyXLex::toInteger(string const & buff) const
{
        if (isStrInt(buff))
                return convert<int>(buff);
        pimpl_->printError(buff, "Bad integer `$$Token'");
        return -1;
}

It I continue the cleanup I would also get rid of that method.


Or you want to extract an integer from the lexer, then an interface like

int i = lex.getInt();

where the integer is converted from an internal buffer of the lexer should
be used.

There is no internal buffer any more with my patch. Everything is written directly to the output. See above.


Nothing to be afraid about. But it's true that it's more a clean up than an
optimisation patch. If we are to switch to XML, I agree that it's maybe
not worth it (even if I spend multiple hours doing it :-( ...)

??? We are going to XML, just not now.

I know and that's why I said it's maybe not worth cleaning up something that is going to scratched anyway.


Abdel.

Reply via email to