Click here to Skip to main content
15,905,419 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGrid and ArrayList Pin
Daniel M. Edwards17-Oct-03 16:59
Daniel M. Edwards17-Oct-03 16:59 
GeneralRe: DataGrid and ArrayList Pin
Heath Stewart18-Oct-03 10:49
protectorHeath Stewart18-Oct-03 10:49 
GeneralUnrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
MtnBiknGuy17-Oct-03 6:45
MtnBiknGuy17-Oct-03 6:45 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
Daniel Turini17-Oct-03 7:08
Daniel Turini17-Oct-03 7:08 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
leppie17-Oct-03 9:33
leppie17-Oct-03 9:33 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
MtnBiknGuy17-Oct-03 16:18
MtnBiknGuy17-Oct-03 16:18 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
Anonymous17-Oct-03 18:24
Anonymous17-Oct-03 18:24 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
MtnBiknGuy18-Oct-03 3:55
MtnBiknGuy18-Oct-03 3:55 
leppie,
Do you happen to know why the following method "is not a valid program"? It compiles fine, but the runtime won't even try to run it. It contains 500 statements (I cut out 497 of them for this post) like those below. The method represents another unrolled loop. (And this is the one I mentioned that is actually 5-10 times slower than the loop after it's unrolled.) I appreciate any comments.
Dave
P.S. I forgot to mention that the problem is related to the number of statements in the method. 1000 doesn't work. I think it works up to a few hundred statements, then stops being "a valid program."

public double DoBruteForceCompute()
{
double bruteForceSum = 0;

point1=coeff1*table[0][0] +coeff2*table[0][1] +coeff3*table[0][2]
+coeff4*table[0][3] +coeff5*table[0][4] +coeff6*table[0][5]
+coeff7*table[0][6] +coeff8*table[0][7] +coeff9*table[0][8]
+coeff10*table[0][9] +coeff11*table[0][10] +coeff12*table[0][11]
+coeff13*table[0][12] +coeff14*table[0][13] +coeff15*table[0][14]
+coeff16*table[0][15] +coeff17*table[0][16] +coeff18*table[0][17]
+coeff19*table[0][18] +coeff20*table[0][19] +coeff21*table[0][20]
+coeff22*table[0][21] +coeff23*table[0][22] +coeff24*table[0][23]
+coeff25*table[0][24] +coeff26*table[0][25] +coeff27*table[0][26]
+coeff28*table[0][27] +coeff29*table[0][28] +coeff30*table[0][29]
+coeff31*table[0][30] +coeff32*table[0][31] +coeff33*table[0][32]
+coeff34*table[0][33] +coeff35*table[0][34] ;

point2=coeff1*table[1][0] +coeff2*table[1][1] +coeff3*table[1][2]
+coeff4*table[1][3] +coeff5*table[1][4] +coeff6*table[1][5]
+coeff7*table[1][6] +coeff8*table[1][7] +coeff9*table[1][8]
+coeff10*table[1][9] +coeff11*table[1][10] +coeff12*table[1][11]
+coeff13*table[1][12] +coeff14*table[1][13] +coeff15*table[1][14]
+coeff16*table[1][15] +coeff17*table[1][16] +coeff18*table[1][17]
+coeff19*table[1][18] +coeff20*table[1][19] +coeff21*table[1][20]
+coeff22*table[1][21] +coeff23*table[1][22] +coeff24*table[1][23]
+coeff25*table[1][24] +coeff26*table[1][25] +coeff27*table[1][26]
+coeff28*table[1][27] +coeff29*table[1][28] +coeff30*table[1][29]
+coeff31*table[1][30] +coeff32*table[1][31] +coeff33*table[1][32]
+coeff34*table[1][33] +coeff35*table[1][34] ;


[...]

point500=coeff1*table[499][0] +coeff2*table[499][1] +coeff3*table[499][2]
+coeff4*table[499][3] +coeff5*table[499][4] +coeff6*table[499][5]
+coeff7*table[499][6] +coeff8*table[499][7] +coeff9*table[499][8]
+coeff10*table[499][9] +coeff11*table[499][10] +coeff12*table[499][11]
+coeff13*table[499][12] +coeff14*table[499][13] +coeff15*table[499][14]
+coeff16*table[499][15] +coeff17*table[499][16] +coeff18*table[499][17]
+coeff19*table[499][18] +coeff20*table[499][19] +coeff21*table[499][20]
+coeff22*table[499][21] +coeff23*table[499][22] +coeff24*table[499][23]
+coeff25*table[499][24] +coeff26*table[499][25] +coeff27*table[499][26]
+coeff28*table[499][27] +coeff29*table[499][28] +coeff30*table[499][29]
+coeff31*table[499][30] +coeff32*table[499][31] +coeff33*table[499][32]
+coeff34*table[499][33] +coeff35*table[499][34] ;

bruteForceSum =
point1 +
point2 + ... +
point500
;

return bruteForceSum;

}//DoBruteForceCompute

GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
MtnBiknGuy20-Oct-03 14:15
MtnBiknGuy20-Oct-03 14:15 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
leppie21-Oct-03 8:48
leppie21-Oct-03 8:48 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
MtnBiknGuy21-Oct-03 10:08
MtnBiknGuy21-Oct-03 10:08 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
Andy Davey17-Oct-03 10:55
Andy Davey17-Oct-03 10:55 
GeneralRe: Unrolling a loop: why can't .NET add 1 + 2 + 3 + ... Pin
MtnBiknGuy17-Oct-03 16:02
MtnBiknGuy17-Oct-03 16:02 
GeneralXML Complex Types Pin
pahluwalia17-Oct-03 6:27
pahluwalia17-Oct-03 6:27 
Generaladd "user" to "COM+ security role" programmatically Pin
Norman Fung17-Oct-03 6:14
Norman Fung17-Oct-03 6:14 
GeneralURGENT, Help me please !!!!!!!! Pin
god4k17-Oct-03 6:02
god4k17-Oct-03 6:02 
Generallistview Pin
jphuphilly17-Oct-03 6:00
jphuphilly17-Oct-03 6:00 
GeneralRe: listview Pin
Corinna John20-Oct-03 1:52
Corinna John20-Oct-03 1:52 
Questionwhy can't I get through the "lock (this)"? Pin
yyf17-Oct-03 5:18
yyf17-Oct-03 5:18 
Generalthe components's comment Pin
wangier16-Oct-03 22:45
wangier16-Oct-03 22:45 
GeneralRe: the components's comment Pin
Eric Gunnerson (msft)17-Oct-03 8:53
Eric Gunnerson (msft)17-Oct-03 8:53 
GeneralRe: the components's comment Pin
wangier19-Oct-03 15:19
wangier19-Oct-03 15:19 
GeneralRe: the components's comment Pin
wangier19-Oct-03 15:24
wangier19-Oct-03 15:24 
GeneralRe: the components's comment Pin
Eric Gunnerson (msft)19-Oct-03 16:41
Eric Gunnerson (msft)19-Oct-03 16:41 
GeneralRe: the components's comment Pin
wangier19-Oct-03 18:51
wangier19-Oct-03 18:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.