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?
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.
@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?
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.
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot