Hi guys, I am writing C # code that currently should run as fast as possible, usually taking up one core with 100% for about 25 minutes. I need the code to remain a single core, since the advantage of running this code in multiple cores will not be as big as running this project several times at once
This code is as follows
public Double UpdateStuff(){ ClassA[] CAArray = ClassA[*a very large number indeed*]; Double Value = 0; int length = CAArray.Length; for (int i= 0; i< length ; i++) { Value += CAArray[i].ClassB.Value * CAArray[i].Multiplier; } return Value; }
This area of ββcode is responsible for 78% of the application load in accordance with the profilers and, thus, is a good candidate for optimization.
!!! Note: the function has been changed from the return type to void to return a Double type, this is pseudocode, not the actual code, to make reading easier
To Clarify: .net, C # 4.0, visual studio 2010, target machine: Windows 2008 x64 server
Edit: further clarification: all variables in this context are publicly available, not properties. The values ββin CAArray [i] .ClassB.Value will forever change if the pairs do not match.
source share