Speed up math code in C# by writing a C dll?
- by Projectile Fish
I have a very large nested for loop in which some multiplications and additions are performed on floating point numbers.
for (int i = 0; i < length1; i++)
{
s = GetS(i);
c = GetC(i);
for(int j = 0; j < length2; j++)
{
double oldU = u[j];
u[j] = c * oldU + s * omega[i][j];
omega[i][j] = c * omega[i][j] - s * oldU;
}
}
This loop is taking up the majority of my processing time and is a bottleneck.
Would I be likely to see any speed improvements if I rewrite this loop in C and interface to it from C#?