Skip to content
Forum Archive

On beat toggle switch

15 posts

OnionRingOfDoom#

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?
hungryskull#
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
Jaak#
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ˇ-9), do you really need "that huge" speed boost?
Nic01#
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
Jaak#
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)';
UnConeD#
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.
Warrior of the Light#
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. 🧟
sidd#
Did anyone realise that he is talking about an on-beat line? does it really matter which is faster?
Rovastar#
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.