Page 1 of 1

Cobra Phase Timings

PostPosted: Thu Oct 14, 2010 1:05 am
by Charles
For those of you who hack on the compiler itself, you may be interested in this. I taught it a new trick tonight, which is to time each of the phases of compilation. Then I applied it to itself (the compiler is implemented in Cobra). Here are the results:

Code: Select all
  28.60%  06.14secs  Parsing source code
  26.29%  05.64secs  Compiling C# code
  23.55%  05.05secs  Generating C# code
  11.97%  02.57secs  Binding implementation
  06.71%  01.44secs  Binding interface
  00.99%  00.21secs  Counting Nodes
  00.87%  00.19secs  Binding inheritance
  00.45%  00.10secs  Reading libraries
  00.33%  00.07secs  Computing matching base members
  00.15%  00.03secs  Binding Cobra run-time library
  00.06%  00.01secs  Identifying .main
  00.02%  00.00secs  Binding use directives
  00.01%  00.00secs  Checking if a default number type should be suggested

So improvements to performance would mostly come from:
-- improving lexing and parsing speed
-- generating C# compiler nodes instead of textual source
-- faster implementation binding and error checking

...at least for larger programs like the compiler. For hello.cobra, the order came out different with parsing and even "generating C#" dropping way down.

Of course, you'd want to use a real .NET/Mono profiler to tell you more of the specifics. But I wanted to see the phase breakdown.

This enhancement is checked in. To use it, you can start with:
Code: Select all
cobra -c -v -timeit hello.cobra

Re: Cobra Phase Timings

PostPosted: Tue Oct 26, 2010 6:01 pm
by Doraemon1673
thanks for that information.

cobra users will be glad to see that codes.

thanks for sharing guys.