I'm starting with dsp programming right now, and I'm writing my first low level classes and functions. Since I want functions to be fast (or finally inefficient), I often wonder what I should use and what I should avoid in functions that are called in the sample.
I know that learning speed changes quite a bit, but I think that some of you, at least, can use the rule or just experience. :)
conditional statements
If I need to use conditions, it switchshould be faster than a block if / else if, right? Are there differences between using two if-statements or if-else? Somewhere I read what elseto avoid, but I don’t know why.
Also, compared to multiplication, is there a rough estimate of how long an if-block takes? Because in some cases, using the use of multiplication by zero can be used instead of if-statements:
if(something) {
signal += something_else;
}
signa+ += something*something_else;
functions and function pointers
Instead of using conditional statements, you can use a pointer function. Instead of using conditions in each call, the pointer can be redirected to a specific function. However, for each call, the pointer had to be interpreted in order to call the desired function. So I don’t know if that would help or not.
I also wonder if the call function affects. If so, boxing functions should be avoided, right?
Variables
, , , . ? , , .
, ? , , . , . , ?
? (*0.5 /2.0)
, soem.