Audio -- How much performance improvement can I expect from from reducing function calls by using bu
Posted
by morgancodes
on Stack Overflow
See other posts from Stack Overflow
or by morgancodes
Published on 2010-03-23T17:42:01Z
Indexed on
2010/03/23
17:43 UTC
Read the original article
Hit count: 382
audio
I'm working on an audio-intensive app for the iPhone. I'm currently calling a number of different functions for each sample I need to calculate. For example, I have an envelope class. When I calculate a sample, I do something like:
sampleValue = oscilator->tic() * envelope->tic();
But I could also do something like:
for(int i = 0; i < bufferLength; i++){
buffer[i] = oscilatorBuffer[i] * evelopeBuffer[i];
}
I know the second will be more efficient, but don't know by how much. Are function calls expensive enough that I'd be crazy not to use buffers if I care event a tiny bit about performance?
© Stack Overflow or respective owner