News:

  • June 30, 2026, 04:14:13 AM

Login with username, password and session length

Author Topic: Lots of Programs vs mostly in Main  (Read 13368 times)

davidbgtx

  • Hero Member
  • *****
  • Posts: 215
  • Host be the Most
Lots of Programs vs mostly in Main
« on: February 16, 2015, 09:17:58 AM »
Does it increase scan time to have a LOT of programs vs putting most everything in the MAIN?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Lots of Programs vs mostly in Main
« Reply #1 on: February 16, 2015, 09:46:24 AM »
Does it increase scan time to have a LOT of programs vs putting most everything in the MAIN?

If a good percentage are not running, it can improve it. There is some overhead though, although I'm not even sure what it is. Think I'll check that.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Lots of Programs vs mostly in Main
« Reply #2 on: February 16, 2015, 10:46:00 AM »
I wanted to see the impact the other day of some programs that run quite a few scans on a particular event, and I wanted to tune how yieldy I configured the programs to be.  I popped up a trend view with the scan time and some discretes to time stamp the trend with the event.  (I had previously been going off max scan time in system info, assuming that was the impact of these programs, but must have been something else, because these programs only increased scan time about 60% from the base level).  Sweet tool!   :)  This thing programs itself!
« Last Edit: February 16, 2015, 10:48:59 AM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Lots of Programs vs mostly in Main
« Reply #3 on: February 16, 2015, 12:05:46 PM »
$MaxScanTime bumps up a bunch...but it is somewhat Heisenberg-y and not a real indication of performance. Ethernet comms are kinda ugly due to the stack overhead, and monitoring causes lots of comms. Serial/USB comms cause far less impact...no stack.

$ScanTime (DST1) is actually an exponential moving average, and is a much better indication of overall performance. If you need the actual scan time of the last scan, it is in $ElapsedTicks (DST4).

I have never really seen a case when using programs hurts things bad enough to matter, and certainly never enough to give up the benefits of modularity. When you then add YIELD and/or Stages to the mix, it becomes even less of an issue.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Lots of Programs vs mostly in Main
« Reply #4 on: February 16, 2015, 02:42:41 PM »
$ScanTime (DST1) is actually an exponential moving average, and is a much better indication of overall performance. If you need the actual scan time of the last scan, it is in $ElapsedTicks (DST4).

Thought there must be some averaging in there.  There is a long program that runs on the leading edge of an event and another slightly less lengthy on the trailing edge.  Knowing what they do, I'd have expected a square step up, then maybe back down a little (first-scan overhead tasks plus execution of the first loop till yield), then steady till done (one loop between each yield), then back down to the base level.  What I saw with both programs was a linear ramp up to the max, then back down in a concave-up curve ending tangential to the original base number.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

davidbgtx

  • Hero Member
  • *****
  • Posts: 215
  • Host be the Most
Re: Lots of Programs vs mostly in Main
« Reply #5 on: February 16, 2015, 05:46:46 PM »

I have never really seen a case when using programs hurts things bad enough to matter, and certainly never enough to give up the benefits of modularity. When you then add YIELD and/or Stages to the mix, it becomes even less of an issue.

That's what I wanted to hear, wanted to keep it modular. Thanks

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Lots of Programs vs mostly in Main
« Reply #6 on: February 16, 2015, 06:07:59 PM »
In Bobo's words: I "embraced program blocks" in my first DoMore project. It has very little in MAIN, with... ahem... a *few* program blocks. ;)
It gets a lot of work done while maintaining impressive scan times.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com