This is on Mono 2.10.9 on Mac OS X 10.6.8. Machine is 2.66 GHz Quad-Core Intel Xeon with 1066 MHz DDR3 RAM.
My test case is the Cobra compiler itself. I copied the older Snapshot/ directory before the optimizations were pushed into it. Then using:
- Code: Select all
cd CobraWorkspace/Source
bin/build -v -timeit
A typical run with the slower Cobra is:
Phase timings:
32.04% 06.06secs Parsing source code
26.80% 05.06secs Generating C# code
17.32% 03.27secs Compiling C# code
14.74% 02.79secs Binding implementation
06.10% 01.15secs Binding interface
01.20% 00.23secs Counting Nodes
00.86% 00.16secs Binding inheritance
00.34% 00.06secs Reading libraries
00.32% 00.06secs Computing matching base members
00.21% 00.04secs Binding Cobra run-time library
00.06% 00.01secs Identifying .main
00.02% 00.00secs Binding use directives
00.00% 00.00secs Checking if a default number type should be suggested
100.00% 18.90secs Total for all phases
Compilation succeeded
timeit compile = 00:00:19.0274273
53322 lines compiled at 2802.4 lines/sec
156927 nodes compiled at 8247.4 nodes/sec
287093 tokens compiled at 15088.4 tokens/sec
And a typical run with the faster Cobra is:
Phase timings:
29.21% 03.91secs Parsing source code
24.26% 03.25secs Compiling C# code
20.18% 02.70secs Binding implementation
13.50% 01.81secs Generating C# code
09.20% 01.23secs Binding interface
01.61% 00.22secs Counting Nodes
00.69% 00.09secs Binding inheritance
00.49% 00.06secs Reading libraries
00.45% 00.06secs Computing matching base members
00.30% 00.04secs Binding Cobra run-time library
00.09% 00.01secs Identifying .main
00.02% 00.00secs Binding use directives
00.00% 00.00secs Checking if a default number type should be suggested
100.00% 13.38secs Total for all phases
Compilation succeeded
timeit compile = 00:00:13.5106138
53322 lines compiled at 3946.7 lines/sec
156927 nodes compiled at 11615.1 nodes/sec
287093 tokens compiled at 21249.4 tokens/sec
The overall improvement is 29.2%.
The parser is 35.5% faster (though really it was the lexer that got faster and probably more than that). Generating C# is 64.2% faster.
I left the Mono garbage collector as the default which is Boehms. In the past, if I set it to "sgen", I get another 15% improvement.
I don't have the numbers handy any more, but memory usage also came down. Maybe something like 25% with fewer "gc resizes" and "generation collections".
A "Hello, world" program benefits less. Like 3.7% faster.
There is a performance regression in Mono which I reported at
https://bugzilla.xamarin.com/show_bug.cgi?id=9679As usual, everything runs faster on .NET and Windows, but I didn't put numbers together there.