Mono: Going Beyond the Standard
Starting with Mono 2.2, Jonathan Pryor's Mono.Options library will be shipping with the runtime. The library itself is not all that remarkable. While certainly useful, especially to those who write a lot of command line application, it is just another library.
But it represents something bigger; Mono is outgrowing the standard. Mono is not just playing catch-up any more, it is trying to move past the CLR in many areas. And as an open source project, they can slip in new libraries at a much faster clip than Microsoft. Instead of trying to build everything themselves, they can simply pick up mature projects like Mono.Options or the collection library C5 and include them in the standard release.
One of the most impressive enhancements announced for the December's Mono 2.2 release is support for SIMD. SIMD is a set of CPU commands that can drastically speed up operations of vectors. Instead of performing operations on each element of an array in sequence, one can use an SIMD instruction to process a vector of up to 16 elements. Below is a list of supported types.
- Mono.Simd.Vector16b - 16 unsigned bytes
- Mono.Simd.Vector16sb - 16 signed bytes
- Mono.Simd.Vector2d - 2 doubles
- Mono.Simd.Vector2l - 2 signed 64-bit longs
- Mono.Simd.Vector2ul - 2 unsigned 64-bit longs
- Mono.Simd.Vector4f - 4 floats
- Mono.Simd.Vector4i - 4 signed 32-bit ints
- Mono.Simd.Vector4ui - 4 unsigned 32-bit ints
- Mono.Simd.Vector8s - 8 signed 16-bit shorts
- Mono.Simd.Vector8us - 8 unsigned 16-bit shorts
The performance gains are remarkable. Using a Spring-Gravity algorithm, a naive C++ program takes 9.5 seconds to run. By comparison, a literal conversion into Mono takes a pitiful 17.7 seconds. But by switching from standard operators to SIMD functions, the time to run Mono drops to 1.7 seconds.
So what are people planning to doing with Mono? Make games for Windows, XBox 360 and the iPhone. You can see more from the PDC 2008 video on Channel 9.
The primary restriction is that iPhone is that doesn't allow JIT compiling. Thi is addressed in the new version of Mono, which allows everything has to be pre-compiled using a NGEN-like program before loading it onto the phone.
If I recall correctly, the XBox 360 has the same limitation. Namely, you cannot turn data sections in memory into executable sections.