Built-in script step time logging

Idea created by Vincent_L on Dec 14, 2016
    Active
    Score13

    Hi,

     

    Analyzing the performance of a script is very cumbersome and time consuming. To do it well, you have to bracket the script step or steps you wan to analyze with variables that will record the time before and tie after. So you have to mare your scripts with lots of those ugly set variables couples.

     

    I'm suggesting, that now that we have scrip line numbers, FMI could automatically log the time, in milliseconds (or better), at which the script step = the line number was invoked.

     

    Then we would have a function to get the script step log.

     

    OF COURSE, I'm not suggesting it to do it every time (or maybe I am if there's no performances penalty), but only if the script is set to with a new script step like that would set Filemaker to log the script step times

     

    so we would have a new script step (like the set error control one)

     

    allow script step time logging [on] (off by default)

     

    a new function Get(ScriptStepTimeLog) that will fetch all the script's script steps time logging as value list with the line number and the execution time (rather than the duration, because execution time is more usefull).

     

    so one exemple wcript woul be

     

     

    1     step A

    2     step B

    3    step C

    4     step D

    5     allow script step time logging [on]

    6     step E

    7     step F

    8    step G

    9     step H

    10 set variable[$mytimes;Get(ScriptStepTimeLog)]

     

    the contents of mytimes would be

     

     

    6     63617313945213

    7     63617313945999

    8     63617313995999

    9     73617313995999

     

    Then we would be able to do whatever we need to with that variables

     

    So logging a script execution time would just consist of adding 2 steps, rather than 2 x number of stuff to monitor. Much cleaner, easier, would encourage us to more often monitor script performance.

    The script readability stays intact

     

     

    Nowadays the above script would have to be

     

    1     step A

    2     step B

    3    step C

    4     step D

    5     set var($mytimes;List($mytime;6 & char(9) & Get ( CurrentTimeUTCMilliseconds ))

    6     step E

    7      set var($mytimes;List($mytime;8 & char(9) & Get ( CurrentTimeUTCMilliseconds

    8     step F

    9     set var($mytimes;List($mytime;10 & char(9) & Get ( CurrentTimeUTCMilliseconds ))

    10    step G

    11     set var($mytimes;List($mytime;12 & char(9) & Get ( CurrentTimeUTCMilliseconds ))

    12     step H

    13 set variable[$mytimes;Get(ScriptStepTimeLog)]

     

    I stress that Filemaker wouldn't need to store anything, it would constuct the time list in memory just for that script, and purge that memory after the script is finished.