This is ment as a peice needing to be optimised, as im a real code newb i dunno where to start in assembler.
Can anyone give me some pointers as to how i`d be able to remove (stack problems) or sse chanels even.
This would be a real help througout all of my builds.
in the second line you have a comparison (reproc<0) but how can reproc get lower than zero? the output range of the line one is 0 < x < infinity... so if this is correct your code could get reduced to this:
streamin in;
streamin hival;
streamout out;
float recall;
recall = (hival==0) & 1 + (hival>0) & hival;
out = (in % recall);
just try it...
now when the range of hival is only positive, you can reduce more:
streamin in;
streamin hival;
streamout out;
float recall;
hival=hival - (hival==0) & (hival-1);
out = (in % hival);
so there is only one comparison but 2 more subtraction which is probably faster because cmpps sucks 😈
infuzion ·
I find if I do not test constantly (every 5 minutes) my changes by subtracting the original code from my ASM & using a Readout to get 0 (or some other testing method), I'll make alot of new bugs.
MyCo ·
yes, but if you don't know input ranges, there is no chance to test 🙂
MegaHurtz ·
You made me delete my post XD.
Thats way better.
Only can this be optimised even further?
The root of the problem is using multiple diy interpolations, and curves o.o.
Next to pow and pong blah blah.
But.. it`s all single chanel.. and monophonic.
giving me a 14-17% ish percentage..
compare it to huge 3 to 8% c++ Plugins
tells me some optimising is in order.
sow some basic pointers will do.
Im not much of a hopper.. mainly i can combine some more.
I`d like to get rid of some chanels.
and stuff like more than 3 voices poly.
infuzion ·
Good math reduction tips MyCo!
MyCo wrote: so there is only one comparison but 2 more subtraction which is probably faster because cmpps sucks
maybe
(added andps)
Core2 65nm:
Both addps & cmpps use same ports, 1 uops, same Latency, same Reciprocal throughput.
andps add, mult or move port, 1 uops & Latency, 0.33 Reciprocal throughput (same as movaps).
I would test both versions out on both platforms (AMD & Intel CPUs) to make sure.
exonerate ·
The bottle neck for your code is the modulus, what is this code supposed to be doing exactly?
Maybe it can be done without the modulus.
MegaHurtz ·
the code is ment to be a clipping guard, that starts over when (in>threshold).
The functionality is within a range of samples..ai a little to very very much.
The speed i want to be using it is a.f.a.p.
the only light way of doing it in my oppinion is to fix the threshold to 1.
And then separating the float, and subtracting the int.
But on a variable range this (reciprocal version) creates very litlle jitter.
as the double int would becouse of the divider/multiplyer.
Basicly it does have to cut the mustard.
And that it does.
speaking of perfect.. it is`nt.. I really don`t grasp that 0.1 becomes 0.099999999999.
shure you gain jits there.. maybe me?
I`d be interested in shaving off cpu on all of my mathematics really, so anything is welcome
Including this btw.
MyCo ·
infuzion wrote: addps 1 uops, 4 Latency, 1 Reciprocal throughput
cmpps 2 uops, Latency, & Reciprocal throughput each
I would test both versions out on both platforms (AMD & Intel CPUs) to make sure.
don't forget the andps instruction that follows each cmpps
infuzion ·
MyCo wrote: don't forget the andps instruction that follows each cmpps
I did forget, thank you MyCo! So I updated the chart above. cmpps still may be faster; it is situational to what CPU is being used, and what instructions are before & after. I would still try both, but your tip is a good one for sure!
MegaHurtz ·
does this apply to all math, vs conditional statements?
MegaHurtz ·
Thx a Bunch.. I did find very helpfull stuff on the wiki too.
Leaving me some time for the important things in life.