Archive: On beat toggle switch


13th January 2004 23:55 UTC

On beat toggle switch
Hey, I've been trying to figure this out, but I just can't think of anything. What I am trying to do is make sort of a toggle switch that works on beat. On beat one, some variable (call it c) would equal 1. On the next beat, it would equal 0, and on the next beat, it would equal 1 again, and so on. Any ideas on how to go about doing thos?


14th January 2004 00:38 UTC

nevermind, I got it, I used the c=bnot(c) thing.


14th January 2004 10:19 UTC

You might want to use c=1-c; it's faster and works the same way.


14th January 2004 12:48 UTC

Why would that be faster? Have you benchmarked it?


14th January 2004 14:26 UTC

No, but generally, an operator is faster than a function.


15th January 2004 01:59 UTC

I just tried testing both. Using a simple line scope. But it is hard to get real results with AVS because the FPS isn't very steady. Bnot() seemed a bit quicker though


15th January 2004 05:33 UTC

Okay, I benchmarked it:
Used sscs:
init:
n=100000;a=0;
point:
7x7 a=bnot(a); or a=1-a;

multiplied scopes 7 times... basicly i have:
7*7*7*100000 a=bnot(a) functions or a=1-a; boo

and results:
a=1-a;
1.2 fps
a=bnot(a);
0.7 fps

basicly using a=1-a; is (1.2-0.7)/(7*7*7*100000) fps faster than using a=bnot(a);

CMON PPL! its 14*(10***711;-9), do you really need "that huge" speed boost?


15th January 2004 05:47 UTC

Umm, you looked at this at the negative way.
1-a is 1.2/0.7 faster than bnot(a), which is quite significant. (not that significant, but yeah.)

Ran my own test (1 n=100000 scope)

a=1-a = 7.8 FPS
a=bnot(a) = 6.6 FPS

I *think* UnConeD made a prediction some time ago that bnot is faster... anyone who doesn't mind digging it up? :P

EDIT : Now with x=-1+i*2;y=a;

1-a = 1.7 FPS
bnot(a) = 1.8 FPS

huh? o_O


15th January 2004 08:25 UTC

lol, now that's weird. How about that a=1-a; is easier to understand as well ;)


15th January 2004 12:50 UTC

Nic, you should grow a brain (j/k)

a=1-a; is 0.8/34300000 fps faster than a=bnot(a);

it about A single 'a=1-a;' being faster than A 'a=bnot(a)';


15th January 2004 17:59 UTC

No, but generally, an operator is faster than a function.
AVS-evallib doesn't work like traditional languages, and even those have inline functions.

Only complicated ones convert to a function call, most 'functions' in AVS work just like operators.

16th January 2004 00:54 UTC

How about that a=1-a; is easier to understand as well
Not really.

16th January 2004 08:04 UTC

Since it doesn't matter which one to use, a=1-a is shorter than a=bnot(a) (two whole characters). The time it takes to write those characters is more than the difference in FPS. :igor:


22nd January 2004 06:30 UTC

Did anyone realise that he is talking about an on-beat line? does it really matter which is faster?


22nd January 2004 11:31 UTC

Although principles are good things.if we know system x is quicker than system y then we should be encouraged to use system x in all/most cases.

The actualy speed saving is irrelevant as these techniques can be used for more complex examples later on and using the quickest way is generally the best practice in vis stuff.

Many programs now-a-day are not a efficent as they should be as computers do stuff soooo quickly and micro fractions of a second do not matter but over time they do matter in compound cases. get the general habit of that way of thinking now it will benifit it teh long run.