For the last few months I have been running a processor-intensive program which I wrote in C# and which is called Zeros6.
The approximate elapsed time, so far, has been 157 days and the total processor time is 1,217 days. [Some details of the computer: Intel Core i7 2600 / 3.4 GHz / 4 cores + hyperthreading -> 8 processors.]
I wrote the program using Visual Studio Express 2010 and version 4 of the .NET Framework (I think).
Anyway, today I decided to install Visual Studio Express 2012. The installer installed version 4.5 of the .NET Framework and then requested a reboot to continue the installation. I stopped the Zeros6 program and OKed the reboot. After the reboot Zeros6 restarted automatically as usual and the Visual Studio installation continued and soon finished. I was then shocked to discover that Zeros6 was running MUCH faster than it usually runs. A speed indicator which is usually fairly steady at 5.5 (picoseconds per digit) had dropped to 2.0 - I had never seen it lower than 5.34. I then stopped and started the program a few times, and rebooted the computer again, but the speed improvement continues to persist. If we call the old speed 100%, the new speed is 275% !!
I am curious to know what is going on.
Some declarations...
uint[] digits;
uint startI;
uint stopI;
public static readonly int bigPowerIncrement = 34;
public static readonly uint myBase = 1000000000;
All 8 processors spend most of their time doing this...
{
ulong carry = 0;
unchecked
{
for (uint i = startI; i < stopI; i++)
{
ulong m = ((ulong)digits[i] << bigPowerIncrement) | carry;
carry = m/myBase;
if ((digits[i] = (uint)(m - myBase*carry)) < 1000000)
{ // do this about one time in 1000...
h.specials[h.specialCount++] = i;
}
} // i loop
} // unchecked
h.carry = carry;
}
It's difficult to know exactly what improved, but there were quite a few improvements in .NET 4.5. As it's an in-place upgrade to .NET 4, you'll benefit from those improvements.
h.specials[h.specialCount++] = i;
If h.specials
is a ConcurrentDictionary<T,U>
, for example, this alone could be the improvement. The ConcurrentDictionary<T,U>
type was dramatically improved in .NET 4.5.
It could also simply be one new or changed JIT optimization that is now benefiting you that was not before, or many other things.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With