In my code I have a block which executes once only:
if(doOnce)
{
Matrix matrix;
doOnce = false;
}
However, I find that when even just a matrix object is created in this block once only, even if it does nothing the entire rest of the program is doomed to execute about three times slower than if the matrix object creation was commented out.
If i declare the matrix object as a global, speed is fine; but then if I
initialise it with 'new Matrix(...)' in the doOnce block or globally the slowdown
continues.
It's not just matrix objects either, any object from the MathNet library will cause a slowdown. I don't understand how this can happen as the object is created and used in a doOnce block, and is only ever seen once in the programs life.
Any help? Thanks