Kepler/SIL/JJupin - Does including a UDR library affects execution time of code?

Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2015

Hello,

 

Lately we have started to build our own User Defined Routines library with all the little useful functions that we often call. We are also trying to improve the efficiency of our code. That made me wondering what is the effect of including a library in each script we use? Is there any slowdown at all if we just include the library, even if we won't use any function from included UDR?

1 answer

1 accepted

2 votes
Answer accepted
Silviu Burcea
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2015

Hi Blazej,

 

There is always a cost. When you define a UDR, when the script is interpreted, the UDR should be saved for later use. Even if you don't use it, the routine has to be defined. It is always recommended to include what you're actually using. You should group your routines by their logic(e.x. arrayUtils.incl should include array routines) and include them when you're actually using.

If you're using some routines more frequently from a library script, maybe it's a sign they are different than the rest of the script and should be moved in a different script. Find a balance between how much a script should contain and how many scripts should be included. There is no right answer(I/O is slow, but maybe with a SSD is faster to use multiple smaller scripts).

 

So, in short, you should avoid including functions you don't use. If they are general purpose functions, they might be included into the SIL core and you'll get what you want: speed and all functions available. We are open to suggestions but we'll try to keep the language clean and simple. You can suggest new routines using our mailing support or our JIRA instance for bugs.

 

Best regards,

Silviu

Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2015

Well, you could use caching to spare parse time. Caching is disabled by default, but can be enabled on the scripts very easily. This would avoid such time costs.

Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2015

@Silviu Burcea Thank you for the directions. Most of the routines that we use are specific to our instance I think, so there is no need to nag you guys about it :) @Radu Dumitriu Do you mean caching set in the SIL Configuration page? Are there any risks connected to caching? Are there any scenarios that caching may slow down executing time of scripts?

Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2015

AFAIK, no, there are no risks. Cache should update automatically when you change the script. When we introduced it, we didn't want to make it the default (we were scared on possible side-effects). Our plan was to add this as default later on. However, in the fury of N-th developments, this 10 minute task is still in our backlog. (ashamed) As we speak, no bug has been reported on the cache.

Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2015

Thanks for the valuable information. I'll try to turn the caching on as soon as possible.

Suggest an answer

Log in or Sign up to answer