SwitchPalace converts managed applications to native.

The resulting applications are faster than JIT-compiled applications, and have no external dependencies.


← Try some sample output.

See how many animated sprites your CPU can render on a moving background without dropping frames.

OS X: Recent versions of OS X require you to control-click (or right-click) the downloaded application and choose “Open” (after unzipping).

Android, iOS, WinPhone, WinRT, BlackBerry: Most mobile platforms require you to “sideload” applications that aren't delivered through the manufacturer's app store. I'm not going to try to keep an up-to-date list of how to sideload applications on each type of device; there are plenty of options just a Google search away.

See how other CPUs performed.

This test was used to determine if CPU-based rendering is feasible for sprite-based games. Most games only need a few dozen sprites atop a moving background, so this should be plenty.

Device Platform CPU Sprites @ 60 FPS
Laptop - 2011 Mac 2.2 GHz Intel Core i7 (Sandy Bridge Mobile) 110,000
Laptop - 2011 Windows 2.0 GHz Intel Core i7 (Sandy Bridge Mobile) 100,000
Laptop - 2011 Managed 2.0 GHz Intel Core i7 (Sandy Bridge Mobile) 74,000
BlackBerry Z10 - 2013 BlackBerry 1.5 GHz ARM Cortex A15 (MSM8960) 26,000
BlackBerry PlayBook - 2011 BlackBerry 1.0 GHz ARM Cortex A9 (OMAP4430) 11,000
Samsung Galaxy S1 - 2010 Android 1.0 GHz ARM Cortex A8 (Exynos 3) 8,700

Implementation

All development and testing is carried out in C#, from the comfort of Visual Studio (or any other language/compiler/IDE combination that produces a .NET assembly). When the application is ready for release, the executable and all of its dependencies are converted to native code for all target platforms (or one at a time, if you prefer).

The bulk of the SwitchPalace utility is the union of two previous projects: a Portable Executable library that can read and write Portable Executable files (the format of .NET assemblies), and a native code generator that can convert the CIL instructions and metadata into various types of native code.

Paired with a collection of small modules that wrap various platform APIs (OpenGL, ALSA, DirectX, etc.), SwitchPalace can convert a managed application into a self-contained native application for the specified platform.

CIL Translation

As for limitations, there are many:

  • The base class library is extremely minimal.
  • The platform API modules don't wrap the various GUI frameworks for each platform (e.g. winforms, WPF, GTK); any UI is up to the application and its libraries.
  • The tool chain can convert assemblies that target any version of .NET, but does not handle generics.

In short, this platform is completely unsuitable for recompiling something like a large enterprise application. It's best suited to applications that are designed for it, so they may produce small native binaries with no dependencies but the platform they target.

Releases

SwitchPalace is no longer in active development now that .NET Core has emerged (with the promise of AOT compilation).

Existing SwitchPalace users can continue to use the software on all .NET versions, so long as no runtime features added after CLRv2 (.NET 3.5) are invoked. Compatibility with .NET Core is untested.