FM18 while function vs recursive custom functions performance question

Hello.

Apologies for the late response – just seeing this thread today.

When I first had my hands on a preview version of v.18, one of the first things I did was to try out a re-written version of a custom function (JSONQuery) which relies heavily on recursion.

I knew that While would help make the code easier to read.

By virtue of the fact that it would obviate the aspect that involved maintaining “state” variables across iterations I expected that the code would perform better.

And then, there was the question of what sort of performance change would there be with having a repeated task performed numerous times using While, versus using recursion.

I no longer have metrics to share, but the performance gain was not significant enough for me to consider releasing a special version of the CF that would use While (but which would not be compatible with pre-18 FMP).

As I recall, queries that heavily taxed the CF would take perhaps 30 seconds in the original version of the CF, and these same queries took between 28 and 29 seconds using the While version. Queries which were more routine and lighter had deltas which could be measured in milliseconds.

These differences seemed very small to me, and I decided it was not worth the overhead involved with maintaining two versions of the function, or with losing v.16, v.17 compatibility.

Really, the plus that I feel was there to be gained (in my particular scenario) was that While would help make a difference with respect to the code being easier to read for anyone unfamiliar with the coding style that I was using when I wrote the custom function.

I hope that the above may be helpful to anyone interested in this topic.

Kind regards to all, and @Cecile, thanks for bringing this forum to life.

-steve

7 Likes

Welcome and thanks for the info!

Hi Steve, I found your fantastic YouTube videos and references to various JSON + SQL custom functions and demo files you created such as the one you mentioned on this thread - JSONQuery - along with JSON_SqlSelect, JSON_SqlField, JSON_SqlResult, etc. I'm very interested in using these CFs can't seem to find them. Do you have links to where these CFs and demos currently reside, as I believe the links to the older Filemaker community boards are broken? Thank you kindly, Jason

3 Likes

Hi @jasonlab

Welcome to the Soup!

I would be more than happy to share the CFs with you.

One thing that I will mention about them:

While I am very pleased with the CFs, and while they do their job well, I believe we have entered an FMP era where the ability to achieve similar functionality now exists through a great variety of new, different, and exciting means. Which is to say that the CFs are still relevant and helpful, but they are no longer one of just a few tools in the shed for the job.

Personally, I am looking forward to seeing what others come up with to meet the same needs and scenarios which inspired those functions.

I will try sending you a PM here on the Soup, so that we can make email contact and I can send the files with the functions to you. (Currently they are not posted anywhere.)

Very best and happy to see you here at the Soup.

-Steve

2 Likes

Hi, could you link the videos ?
Thanks

I think it's this video @Vincent_L. Querying JSON in FileMaker using JSONGetElementWhere - YouTube

1 Like

awesome, thanks