-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speedup rendering functions #573
Conversation
See issue #571
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising, I will add a unit test on master, similar as the one for fluid_synth_process()
, to be sure that nothing else breaks. Meanwhile, see below.
|
||
synth->cur = l; | ||
synth->cur = cur; | ||
|
||
time = fluid_utime() - time; | ||
cpu_load = 0.5 * (fluid_atomic_float_get(&synth->cpu_load) + time * synth->sample_rate / len / 10000.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When control reaches here, len
will be zero, causing a DIV by zero. Recompile with cmake -Denable-trap-on-fpe=1
to get a SIGFPE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, I did not notice the use of len into cpu_load, I will fix it.
Immediately after fixing the SIGFPE error, I noticed that the 'i' and 'j' variables could be deleted safely. loff and roff are added to left_out and right_out, so the lincr and rincr can be added directly to the pointers.
Thanks for speed enhancement, however this new implementation doesn't behave as before. *left_out = (float) left_in[n]; This could lead with possible memory violation access. To fix that the outer loop do; {..} while(size) Please, why did you use a reverse indexing ?. Shouldn't a classic indexing be more faster ? and easier to read, like this:
} |
I fixed the case when
No, I don't think so. The readability of the code is quite subjective, but in my opinion the condition |
Reversed indexing is fine for me.
I wouldn't nit-pick too much on those issues. After all, we are only talking about integers, and most of the time will be spent when accessing |
1)Interesting idea !.
|
Actually, I did that intentionally instead of using a while() on top of the loop, it is true that the compiler could unroll the loop, but in my opinion it would be worth to help on this piece of code. |
It is a good idea, although this seems to be platform dependant. |
I'm curious of the improvements you got. Would you please report these result ? |
Ok.
Me too. Unit test passed, will merge it now, because it's convenient for me. Thanks. |
See issue #571