Introduction
The past few years, I’ve become increasingly more interested in FileMaker’s speed. Recently, I learned that FileMaker was known to slow down in long running scripts. I wanted to know more about that, which in turn got me interested in speed measurement. As it turns out, it is not that straightforward.
This post will go into the effect that the measuring system influences the measurement.
The basics
Measuring speed in this case means, how long does it take FileMaker to perform a certain task. That seems simple: measure time at x, do whatever it is you want to measure and measure the end time y. A script version would look like this if we wanted to measure how long it takes to set a variable to a number.
Set Variable [ $start_time; Value:Get ( CurrentTimeUTCMicroseconds ) ]
Set Variable [ $a_number; Value:5 ]
Set Variable [ $end_time; Value:Get ( CurrentTimeUTCMicroseconds ) ]
Set Variable [ $$duration; Value:$end_time - $start_time ]
This would measure how long it would take to set a variable while using a script step, right?
Wrong.
The flaw
The script above measures how long it would take to set one variable to 5, plus setting another variable to the current time.
How does that work? Well, the internal workings of software at machine language level are incredibly complex, but
- … at some point, for the variable $start_time the current time is determined. To fully execute the script step, work may need to be done, which takes start_time_post time.
- Then the variable $a_number is set, which takes a_number_duration time
- Then some preparation work may need to be done before the current time for $end_time is determined, which takes end_time_ante
- Then $end_time – $start_time = start_time_post + a_number_duration + end_time_ante
- Assume start_time_post = end_time_post, because apart from the variable name, the steps for stetting $start_time and $end_time are exactly the same.
- Then $end_time – $start_time = end_time_post + a_number_duration + end_time_ante
It’s not exactly a mathematical proof, but hopefully convincing enough. And if not, then try the same script without the step to set $a_number.
The measurement itself takes time
The measurement itself takes time. In this case, instead of one set variable script step, two were measured, which relatively speaking, is a big difference. Normally, one would measure far more complex script steps or combinations thereof, so the influence of capturing the start and end time is relatively small. Yet, …
Other influences
On the other hand, the scripts, calculations and custom functions one uses to measure FileMaker’s speed in real applications also may be more complex. My experience tells me that there are other ways in which the measuring influences the measurement. It is a long story, but the gist of it is that a Pause script step ( to allow a refresh of a progress indication to the user ) caused unexpected effects and set me on the wrong foot for weeks.
The takeaway
Measuring FileMaker’s speed with FileMaker influences the measurement. The influence may be small, but it could be big and show up in unexpected ways. Be careful designing and implementing speed measurement methods. For starters, test what it does when it is supposed to measure nothing. One cannot avoid all influence, but one should at least be aware of possible influences when interpreting the results.
PS About this post
This text was written by me ( a human ). I followed up on an AI’s suggestion to use more headers. Also, I wanted to write a much longer post, discussing other speed measurement considerations, but the AI’s suggestion made me realize, that this is a blog post not an essay.
The post’s image was generated by an AI.