Miguel de Icaza has a blog entry where he describes the new SIMD support in Mono. He has ported to C# a C++ application, to illustrate the new SIMD stuff, and then he compares the results, the C++ program was rather slow. I had a look at the source code an I've seen that the C++ program was compiled in debug mode.
I've decided to make a few tests for myself. I've used MinGW 4.3.2 and Visual Studio 2005, the tests where run on my Intel Mobile Core 2 Duo T7500.
Here are the results (in seconds):
The parameters for the above results were:
Mono is not quite there yet (at least on Windows).
I had to change the timing code for the C++ code, glib::GTimer is not a very good option on Windows. I've used the high-resolution performance counter, the code is presented below:
#ifndef PERFTIMER_H
#define PERFTIMER_H
#include <windows.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
class PerfTimer
{
LARGE_INTEGER start_;
LARGE_INTEGER stop_;
LARGE_INTEGER freq_;
public:
PerfTimer()
{
QueryPerformanceFrequency(&freq_);
}
void Start()
{
QueryPerformanceCounter(&start_);
}
void Stop()
{
QueryPerformanceCounter(&stop_);
}
std::string ToString()
{
const int precision = 10000000;
unsigned long time = static_cast<unsigned long>(
(stop_.QuadPart - start_.QuadPart) * precision /
freq_.QuadPart);
std::ostringstream os;
os << std::setfill('0');
os << std::setw(2) << time / precision / 3600 << ":";
os << std::setw(2) << time / precision % 3600 / 60 << ":";
os << std::setw(2) << time / precision % 60 << ".";
os << std::setw(7) << time % precision;
os << std::setfill(' ');
return os.str();
}
};
#if 0
int main()
{
PerfTimer timer;
timer.Start();
Sleep(1250);
timer.Stop();
std::cout << "Time: " << timer.ToString() << std::endl;
return 0;
}
#endif
#endif // PERFTIMER_H
There are a few things I would like to point out about the Mono 2.2 Windows installer.
1. The executable is not digitally signed by Novell.
2. The graphics are hideous, 16 colors dithering? why? Is anybody in their right mind running Windows in 16 colors?