Archive: I wish...


1st July 2003 12:33 UTC

I wish...
Could anyone put together a speed list of functions, I mean a list of all AVSs functions sorted by how slow-fast they are? I know I could use it, and I think it could be useull to others to (IMHO).


1st July 2003 18:33 UTC

Erm, functions?

Just gimme some examples because this could be anything.


1st July 2003 22:13 UTC

functions. y'know, those things with a word followed by parentheses?

fsk, how on earth would you use this? more importantly, how on earth would anyone actually find the speed drop in any of these, or quantate it? furthermore, functions like pow(,) vary depending on the variables passed to it. all you really need to know is approxmiately how much one function will do in comparison with another and see if you can take shortcuts based on that.


2nd July 2003 02:32 UTC

Well you could use a timing APE that is put before and after the component that needs to be checked. That way it's not affected by framelag and whatnot (snapping to 33.3 FPS for example).

Then you make pieces of code containing N calls to a certain function, repeat it a couple hundred times (use a php script or something to generate this, unless you're nuts) and paste it in a scope's perframe with n=0 in the init. The way I understand it, you should simply use "sin(a);" and not "b=sin(a);" (otherwise the setting of b is timed as well, though it doesn't matter for relative numbers).

That way you get a relative scale of speed, and if you divide by 'N' you can get an estimate of the time needed for one instruction. Though I wouldn't do that, considering the inefficiencies revealed in the "AVS mysteries" thread (for example everything is a function call, even a=b or a+b).

If you time using QueryPerformanceCounter() you can get a resolution of several µs (not a typo) which should get good enough ;).


3rd July 2003 17:25 UTC

But then again this is all relative to the hardware we use. And i think the benchmark thing came up before.

And if we knew, would that affect our way to programm avs, just to get a few more µFPS out per minute?


4th July 2003 11:45 UTC

guys you took this a bit to seriously, or I just asked the wrong way:). what I ment is .... well I heard about how sin and cos are slow ones and then the thing about division and I was wondering if there are any other instances of these slow ones.
like are logical functions slow and if so, why .

Maybee i shouldnt have said avs functions because stuff like devision is slow anywhere (and yes division isnt a function :rolleyes: ).

anyway i hope you know what I mean now:)


4th July 2003 14:23 UTC

I don't think logical functions are too slow. Here's a rough order of the ones that I know:

All trig functions
log/log10
sqrt ?
pow
sqr
/
*
+ -


Anything that would be hard as crap for you to do without a calculator/computer is probably going to be hard for the computer as well. Most people can't tell you what the sin(.34642) with just pen and paper.


5th July 2003 02:41 UTC

But people could estimate it at near .3


5th July 2003 04:37 UTC

I don't think that most people could do that. Most of the kids in my trig class just memorized the ones the teacher told them to memorize and used the calculator for the rest - they probably had no idea what a sine curve looked like.


5th July 2003 04:58 UTC

In my algebra 2 class we went over graphing the sin/cos/tan functions for about a week, I think. I don't see how you could do trig without knowing at least what they look like, although I haven't taken trig so maybe I'm wrong.


5th July 2003 07:17 UTC

I had a bad teacher, so I don't think many people in there knew much about the trig functions.


5th July 2003 15:10 UTC

Some people learn about sin/cos/tan as triangle side ratios, other learn about them in a circle.
In the first case, sin is not really defined in function of a fixed angle, so it's hard to imagine how sin(x) looks. In the second case, stuff like periodicity is easy to see.


6th July 2003 05:50 UTC

I build an image of a circle using the y=sin(t) x=cos(t) rule and use that.


6th July 2003 20:57 UTC

I learned to use it both ways. But you'll forget about those things soon if you don't need em permanently, so most of the people surely wouldnt be able to imagine how it looks like (one or the other way)


16th July 2003 17:10 UTC

been away for a while (no school no net).
Anubis that's the thing i wanted. Could somone put logicals and modulo somwhere in there:)? Another thing im wondering about is parantheses, do they slow things down?

I asked Unconed about this once, but that was before he found out that AVS doesnt optimise shit.Which is better?:

c=if(sw,a,b); (sw is 1 or 0)
c=a*sw+b*bnot(sw);
--------------
c=bnot(above(b,0));
c=1-above(b,0);
------------------
a=if(sw,a,a+b);
a=a+b*sw;
-------------------------

now if all the second ones are faster what the f*** is 'if' good for:? and bnot is only useful if the value is over 1?.


16th July 2003 18:13 UTC

I have no idea:confused:


16th July 2003 20:41 UTC

c=if(sw,a,b); (sw is 1 or 0)
c=a*sw+b*bnot(sw);

The second one will be much, much slower because it contains 2 multiplications, 1 addition and 1 bnot.
The first contains no operators, only the loading of sw, a and b.


22nd July 2003 06:45 UTC

And besides, the second version needs more text decoding work than the first one!


22nd July 2003 14:00 UTC

Magic.X: Irrelevant, because AVS compiles it into a tree-like structure once and uses that later on.


22nd July 2003 14:39 UTC

U-huh! But how does it check for changes? Checksum comparism??


22nd July 2003 16:06 UTC

Eh? Whenever the contents of the editbox changes, the code is recompiled. As you should know, Windows sends a notification message for just about anything to a program.
Why would that even be an issue??

Compiling such small pieces of code in a simple language is almost instantaneous anyway.


23rd July 2003 08:02 UTC

Ok, yeah now as you said, you're right of course. An compiling without any optimizing wouldnt take too long.


5th October 2003 10:04 UTC

Good idea. COOL!!!


5th October 2003 15:50 UTC

bnot is handy for making an easy solid scope. example:

a=bnot(a);
x=a;
y=i;

This will result in a solid square:

a=bnot(a);
x=a-0.5;
y=i-0.5;

Centered square. Easy or what?


6th October 2003 07:56 UTC

what the hell? you ressurected a 3 month old post just to say it was a good idea?

obviously it wasn't or else people would still be talking about it :rolleyes:


6th October 2003 08:05 UTC

I didn't want to say it ;). I think he just likes posting to everything.