Faster Piston?

Hello everyone, what is faster? one very long piston (30-35 chunk, 10-15% memory used) or many small pistons?

If you are chaining the pistons there will likely be a very small penalty to do the hand off, but if all the pieces are triggered from events I doubt that you’ll see a noticable difference if both are constructed reasonably well.

I generally favor simplicity…

I am no expert, but can think of a some dependencies. There may not be an absolute rule.

For instance, once a piston is called, it runs all the way through. So, if it has to check a dozen or so extra conditions each time, then that will add overhead. Not sure where the breakeven point is for optimizing speed.

I usually use 2 active pistons. the first, the heaviest one, is the rules engine, manages the change of modes (day, night, alarm, party), pauses and resumes other pistons, sets global variables and Alexa speaches. the second (very light) changes according to the mode, manages which lights to switch on, which sensors to activate and which shutters to raise. I was thinking of streamlining the first piston by dividing it into two or three parts ...

Do you have what are average run times for the current piston?

How often does it run - few times a day, many times an hour?

A longer piston can 'do not much', or can 'do a lot' on each execution, so that could matter.

In short, the size is not the issue, it is how much it runs.

I do agree with comments on keep things simple just for understanding / reliability of operations, but I have some pretty large pistons that in simple executions are 3 ifs typically.

As to operation

  • on first run of a piston (like after a save or hub reboot), webcore does a bit more work to optimize things, but after the first run, it does not do that again.

    • so when timing things, skip the first run as it is an outlier.
  • the biggest thing I find affecting performance is logging on / off.

    • so after debugging, turn down or off the logging for the piston (and if off clear the IDE logs for the piston)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.