Should I be stubbing out BUTON_EVENT RELEASEs?
Joe Hebert
Junior Member
I very rarely use the RELEASE for a BUTTON_EVENT (volume is the only one that comes to mind) and so I very rarely have a RELEASE: handler. Shouldn?t I be stubbing out the RELEASE in every BUTTTON_EVENT so Netlinx doesn?t have to make an unnecessary pass through mainline looking for it?
Do you all stub your RELEASE?
Do you all stub your RELEASE?
Comments
-
NO release in button events
I just never include the release statement in the button events. Does that slow the event itself down then?
Could be critical in some systems I have hundreds of button events. -
stub your release? What does that mean (im dutch
)
i only use the release function when i really need it (volume or camera control for instance) -
stub = empty code block, as in: RELEASE : {}
I don't bother, I don't believe it matters. -
I only use it when I need it like the previous posters - volume, or setting presets, or whatnot.
-
Joe Hebert wrote:Do you all stub your RELEASE?
"Stub" (verb) to put in a piece of code that does nothing just to emphasise the fact that you are doing nothing.
I support stubbing in lots of places eg switch/case defaults as a way of reminding yourself that you have or haven't thought about it. I even have a routine called DoNothing() which I sometimes use to amuse those who follow me. If anyone wants the code just let me know ;^)
But as many have noted, releases are so rarely relevant that I don't bother.
I do not believe that there is any performance implication either way. -
offcourse, a stub... didnt know the expression "to stub something"
-
yuri wrote:offcourse, a stub... didnt know the expression "to stub something"

Not sure, when I stub my toe, it definately doesn't feel like NOTHING happened :P
Jeff
-
Every button PUSH has a RELEASE if you enter release code or not.
-
Neologismyuri wrote:offcourse, a stub... didnt know the expression "to stub something"

That's because Joe just made it up and it's such a good word everyone else ran with it! -
Exactly. That is why I think it matters and can make a difference when there is no RELEASE in a BUTTON_EVENT.GSLogic wrote:Every button PUSH has a RELEASE if you enter release code or not.
Consider the attached picture and the following code.DEFINE_DEVICE dvTP = 10001:1:0 DEFINE_EVENT BUTTON_EVENT[dvTP,1] { PUSH: { SEND_STRING 0, 'PUSH from Event' } } DEFINE_PROGRAM PUSH[dvTP,1] { //mainline won't get called since the push is in event table. SEND_STRING 0, 'PUSH from mainline' } RELEASE[dvTP,1] { //mainline will get called since the release is not in the event table. SEND_STRING 0, 'RELEASE from mainline' }
Output when button 1 is pushed and released:
Line 1 :: PUSH from Event - 02:26:47
Line 2 :: RELEASE from mainline - 02:26:47
When the PUSH is triggered mainline does not get serviced since the PUSH was found in a BUTTON_EVENT. When the RELEASE is not found in the event table, Netlinx also has to run through mainline to try to find a match. So some of the event driven power that Netlinx offers is diminished to a degree when it has to double up on work by looking through the event table and mainline.
How much of a performance implication can certainly be debated but I do believe there is one. Perhaps it?s too minuscule to matter though in most applications.
It?s an esoteric euphemism which only AMX programmers are privy too. Stub your release has several different meanings. One example of usage: If you are driving down the highway and an AMX programmer cuts you off in traffic you can roll down your window and yell, ?Hey buddy, go stub your release!?yuri wrote:stub your release? What does that mean (im dutch
)
-
So Joe, in a nutshell, this would mean we should be "stubbing our releases"?
-
I?m not sure, yuri. That?s why I posed the question to the group. I?m thinking maybe we should for the reasons stated above but I may be in the minority.
-
Only in Chicago; in L.A. you may give you the one-stub salute; and in my town, 99.7% of the population doesn't know what AMX is, so a stub is pretty worthless.Joe Hebert wrote:If you are driving down the highway and an AMX programmer cuts you off in traffic you can roll down your window and yell, ?Hey buddy, go stub your release!?

However, in all seriousness, this is a pretty interesting topic, and probably would agree with you Joe - that even though the release is "searched" for in mainline, very little (if any) performance would be impacted. This almost falls into the same performance debate of, "should I use for-loops in mainline, or spell everything out?" I would love to hear from a Programming Master or even an AMX old-timer on this topic . . ..
-
Defeating action in the Define_Program section
Your code can have a stub, but you cannot stub your code.
stub (stub) noun
A routine that contains no executable code and that generally consists of comments describing what will eventually be there; used as a placeholder for a routine to be written later.
If you don't want to have your Define_Program section processing button releases then it would be a good idea to have a RELEASE: with no code.
This would handle all releases of a single touch screen port.Define_Device dvTP = 10001:1:0 Define_Event Button_Event[dvTP,0] { Release: { // No release code defined } }I do not believe there would be any run time improvement only a 'main line' filter. -
One stub fits all. Good idea, Brian.B_Clements wrote:This would handle all releases of a single touch screen port.
Define_Device dvTP = 10001:1:0 Define_Event Button_Event[dvTP,0] { Release: { // No release code defined } } -
This issue seems to be resolved, however, if I were to use the stubbed [dvTP,0] button_event, would any code in my other button_events that have release code (i.e. volume releases, preset setting/recalls, etc.) execute? Or is the stubbed [dvTP,0] button_event used only in a program where you do not have any need for a release?
-
Yes it would.jjames wrote:if I were to use the stubbed [dvTP,0] button_event, would any code in my other button_events that have release code (i.e. volume releases, preset setting/recalls, etc.) execute? -
I think the real question here is if such stubs actually grant any benefit. I am inclined to think that if you don't put it in yourself, it's implicit, and there is no performance difference. I only stub when I want a placeholder to make my code easier to follow.
-
Okay then...
... to open another can of worms...
Should we then also be stubbing HOLDs in the Button_Events? -
HOLD me, my brain hurts.
-trav -
Bad Ideaericmedley wrote:Okay then...
... to open another can of worms...
Should we then also be stubbing HOLDs in the Button_Events?
Absolutely Not!
It would be like generating a huge stack of WAITs with no purpose.
Don't even go there. -
B_Clements wrote:Absolutely Not!
It would be like generating a huge stack of WAITs with no purpose.
Don't even go there.
: ) (gotcha!)
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums