EDIT: Seems to have disappeared.
I've benchmarked some parts of my code and found out that if its like this:
if(oneCondition)
{
performOne();
performOne_two();
abc();
def();
gh();
} else
{
performTwo();
performTwo_two();
abc();
def();
gh();
}
it runs significantly faster than if its like this:
if(oneCondition)
{
performOne();
performOne_two();
} else
{
performTwo();
performTwo_two();
}
abc();
def();
gh();
(In relation: the first version takes around 585ms while the second version takes around 610-630ms).
Can someone explain me why?
This is the code part: (Its part of a backpropagation algorithm for a neural network)
https://pastebin.com/9WfEJdPt // I have moved on
The linked code uses the same functions with a different data feed/argument. Your JIT apparently found a way to optimise at least one of the common functions for at least one of those matrix types. Most likely you have either pExpectedOutput or this.weightMatrixes[layerNr + 1] hardcoded. Ideally the JIT should be able to make this distinction by itself, eliminating the need for redundant code.
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