Rolf's Visual Basic 8 compiler: Self Hosting on Mono

Rolf has committed to SVN his latest batch of changes that allowed his Visual Basic.NET compiler to bootstrap under Mono/Linux. This basically means that the full cycle for VB in Mono has now been completed.

Rolf's VB compiler is an implementation of Visual Basic.NET version 8. So it has support for generics and all the new stuff in the language.

Rolf wrote his compiler in VB itself, and he uses generics everywhere, so in addition of being a good self-test, it has proven to be a good test for Mono (he already has identified a few spots where the Mono JIT should be tuned).

The following are from an internal email he sent on Friday (am trying to convince him to have a blog and blog these fun facts):

Friday Results:

        compile vbnc with vbc:                      4.8 seconds
        compile vbnc with vbnc/MS:                 14.2 seconds
        compile vbnc with vbnc/Mono/Linux:         15.1 seconds
        compile vbnc using a bootstrapped binary:  19.0 seconds

        compile vbruntime with vbc:                 1.4 seconds
        compile vbruntime with vbnc/MS:             3.5 seconds
        compile vbruntime with vbnc/Mono/Linux:     4.2 seconds
        compile vbruntime with bootstrapped binary: 4.9 seconds

The memory consumption on Friday was at 475 megs of RAM. Ben and Atsushi provided some suggestions, and the results for Monday are:

	compile vbnc using a bootstrapped binary:  10.0 seconds

	Memory usage: 264 MB

In managed applications memory allocations are important, because they have an impact on performance. Also notice that memory usage as reported by the Mono default profiler, means all the memory allocation. The actual working set is much smaller, since the GC will reuse all unused memory.

Atsushi also has a few tune-ups to the string class that reduces plenty of the extra allocations that the compiler was incurring into.

To bootstrap your own VBNC compiler, get the vbnc module, then go into the vbnc/bin directory, and run make bootstrap.

Bonus: in addition to bootstrapping itself, the compiler can now compile the Microsoft.VisualBasic runtime (the new version is written in VB.NET as well). And can do a full bootstrap with the new runtime as well.

Although binaries compiled with Microsoft's VB.NET compiler would run unmodified on Linux, it was not possible to use VB code in ASP.NET applications (as those get compiled on the first page hit) or if developers wanted to debug and tune up a few things on their target Linux/OSX machine.

In the next few weeks we hope to have this packaged.

Posted on 09 Jan 2007 by Miguel de Icaza
This is a personal web page. Things said here do not represent the position of my employer.