Re: OpenEuphoria's Strategy
- Posted by dcuny Feb 04, 2015
- 2585 views
There's bound to be some inner loop that is required to be as fast as possible. If the HL equivalent isn't too lengthy said inner loop could be written in ASM. Almost like Pete has done in Phix, I use ASM snippets in Orac. Since apparently C is not fast enough do you require MMX operations?
I'd rather not resort to that. The output doesn't have to be real time, it just can't be too slow.
It was taking 184 seconds to render 55 seconds of audio yesterday.
So I ran the profile against it. It took several attempts, because I kept exceeding the profile limits.
I finally got it to work with:
with profile_time 50000000
Here's one place that had an obvious optimization:
-- filter sample atom out = sample*this[B0] + this[Z][1]*this[B1] + this[Z][2]*this[B2] - this[Z][3]*this[A1] - this[Z][4]*this[A2] -- shift history this[Z][4] = this[Z][3] this[Z][3] = out this[Z][2] = this[Z][1] this[Z][1] = sample
Indexing indexes is horrifically expensive in Euphoria. I replaced it with:
-- filter sample atom out = sample*this[B0] + this[Z1]*this[B1] + this[Z2]*this[B2] - this[Z3]*this[A1] - this[Z4]*this[A2] -- shift history this[Z4] = this[Z3] this[Z3] = out this[Z2] = this[Z1] this[Z1] = sample
and dropped the time to 42 seconds. I shaved another 8 seconds off by optimizing a few more operations.
I'll look at further optimizations later, but for now I've got more important things to fix.
- David