Does F# Break a Fundamental Principal of .NET?

I recently read an (old) news brief in InformationWeek (September 14, 2009) about a group at Grange using the F# programming language.  For those unfamiliar with it, F# is a relatively new programming language developed by Microsoft Research to target the .NET platform.  It is a functional language that is a variant of the ML programming language and mostly compatible with OCaml.  From the article…

Performance is what really sets F# apart. Using C#, Grange can rate 50,000 policies in seven hours. With F#, that takes 5 to 7 minutes. Grange expects F# will vastly improve its speed to market with new prices. With hundreds of rate changes annually, Grange’s pricing team must process a proposed change 10 to 15 times, with each taking 4 to 8 hours. With F#, processing a change takes 5 to 10 minutes, so instead of a proposed rate change taking up to 15 days to finalize, it can be finished in a few hours.

This is pretty exciting news for Microsoft and .NET developers in general, but I was surprised by the results.  One of the most basic concepts of the .NET platform is that all source code is ultimately compiled into an intermediate language (CIL, previously MSIL).  The intermediate language is a sort of pseudo-assembler code for a specific version of the .NET run-time virtual machine.  Microsoft has stated since the inception of the .NET architecture that regardless of the language used to develop an application, the resulting IL code should be the almost identical between equivalent source programs.  If the F# compiler is able to produce IL code that is superior to that of the C# compiler, what would this mean for the platform?  The difference could be even more aggravating than the Visual Basic .NET versus C# holy war that has been raging on since forever.  Perhaps because F# is still considered a research language some features haven’t made it into the .NET base class library.  If and when they do should we assume that C# will benefit from them as well?

It does seem that most groups who are experimenting with F# are using it for scientific projects, math or chemical analysis, and so on.  I’m wondering if the language structure is better suited to describing those particular problem solutions more than it is simply “faster” at doing so.  One major technical difference is F#’s support for inlining where other .NET languages currently lack this.  In addition, functional programming typically makes more extensive use of immutable types.  That style is less common in VB and C# since it restricts the freedom of the developer.  What role do these types play in the performance improvements reported?

× Comments are closed.