View Full Version : 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, 17:33
Just gimme some examples because this could be anything.
1st July 2003, 21:13
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, 01:32
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, 16:25
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?
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, 13:23
I don't think logical functions are too slow. Here's a rough order of the ones that I know:
All trig functions
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, 01:41
But people could estimate it at near .3
5th July 2003, 03:37
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, 03:58
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, 06:17
I had a bad teacher, so I don't think many people in there knew much about the trig functions.
5th July 2003, 14:10
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, 04:50
I build an image of a circle using the y=sin(t) x=cos(t) rule and use that.
6th July 2003, 19:57
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)
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)
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, 17:13
I have no idea:confused:
16th July 2003, 19:41
c=if(sw,a,b); (sw is 1 or 0)
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, 05:45
And besides, the second version needs more text decoding work than the first one!
22nd July 2003, 13:00
Magic.X: Irrelevant, because AVS compiles it into a tree-like structure once and uses that later on.
22nd July 2003, 13:39
U-huh! But how does it check for changes? Checksum comparism??
22nd July 2003, 15:06
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, 07:02
Ok, yeah now as you said, you're right of course. An compiling without any optimizing wouldnt take too long.
5th October 2003, 09:04
Good idea. COOL!!!
5th October 2003, 14:50
bnot is handy for making an easy solid scope. example:
This will result in a solid square:
Centered square. Easy or what?
6th October 2003, 06:56
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, 07:05
I didn't want to say it ;). I think he just likes posting to everything.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.