[Mono-list] mcs compiles on linux. Now what?

Dan Lewis dihlewis@yahoo.co.uk
Fri, 8 Mar 2002 11:38:34 +0000 (GMT)


 --- Paolo Molaro <lupus@ximian.com> wrote:
> 45-50 % of the time is spent parsing, now. miguel mentioned he had a few
> ideas about ways to speed-up the parser, maybe when he wakes up
> he can elaborate. Loading the file in memory at once is sure worth,
> but this should probably be implemented at the IO.FileStream level.

Is there any way to find out how much of this is spent in the lexer? MCS uses a
custom lexer, and in particular uses a hashtable lookup to recognize keywords.

String.GetHashCode() is computed in C# at the moment. It should definitely have
an icall (btw I'm not saying that icalls are the way to make things faster --
but it's such a fundamental operation). Also it is not cached, although strings
are supposed to be immutable, right? Perhaps change it to:

  public override int GetHashCode () {
          if (!is_hashed) {
                  // compute hash_code
                  is_hashed = true;
          }

          return hash_code;
  }

This may/may not make any difference. As ever, profiling's your best weapon :)

In general custom lexers are slower than machine generated ones. I did some
work a long time ago on porting a fast lexer generator to C# -- I could dig it
up if there's need for it.

Dan.


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com