Dafny's /optimize Feature
As of changeset ef62044ec299, you can now specify the /optimize option to instruct Dafny.exe to produce an optimized build of your program.What does this mean?
- Dafny will enable an optimized version of the prelude that is included in the C# code it generates by passing /define:DAFNY_USE_SYSTEM_COLLECTIONS_IMMUTABLE to the C# compiler.- Dafny will pass the /optimize flag to the C# compiler, which is similar to producing a release build.
Fulfilling /optimize Prerequisites
The optimized version of the prelude uses Microsoft's new immutable collections, which perform much better than Dafny's default collections. Dafny keeps a copy of this assembly in its Binaries directory, so you should be able to use /optimize without any special preparation.When you pass the /optimize option to Dafny.exe, Dafny will copy System.Collections.Immutable.dll into the directory where the output assembly is written to. Your compiled Dafny program or library will not function without this DLL in the search path.