Search code examples
roslyncompiler-as-a-service

What are the benefits of using Roslyn - compiler as a service


What is CaaS (Compiler As A Service) in regards to the Roslyn project?

How does using the Roslyn feature improve the performance of a C# application over the current C# 4.0 compiler?

What are the known limitations/issues in the Roslyn-CTP?


Solution

  • What exactly does Compiler as a Service (CaaS) mean in relation to Roslyn? You can watch a video where Anders Hejlsberg explains that (talk about Roslyn starts at 35 minutes in). Basically, the old C# compiler is a "black box": source code comes in, compiled assemblies come out. Roslyn gives you access inside that box. That means you can get syntactic and semantic information about some code, modify it and give it back to the compiler to process it further. You can use that to do code analysis, refactoring, code generation and more.

    There is a long list of features that are not implemented in the current CTP on the Roslyn forum.

    Regarding performance, I don't think that's among the goals of Roslyn. Besides, the JIT compiler is more important for performance optimizations than the C#/VB compiler. And Roslyn replaces the C#/VB compiler, not th JIT compiler.