Edit User metric warning if use sample() function

.. its much faster to vectorize and use the samples() function in init
   or value function when working with user metrics.

   for example this code:

   sample {
      work <- work + (POWER * recIntSecs);
   }
   value { work; }
   count { Duration; }

   should be refactored to:

   value {
      work <- sum(samples(power) * recIntSecs);
   }
   count { Duration; }
This commit is contained in:
Mark Liversedge
2020-06-24 08:15:06 +01:00
parent fdf6d4e862
commit 028e822aa4

View File

@@ -2725,6 +2725,8 @@ DataFilterEdit::checkErrors()
QStringList errors = checker.check(toPlainText());
checker.colorSyntax(document(), textCursor().position()); // syntax + error highlighting
if (checker.rt.functions.contains("sample")) errors << tr("Warning: sample() is slow -- update code to use samples()");
// even if no errors need to tell folks
emit syntaxErrors(errors);
}