Performance Tips & Hints
This page contains tips and hints for improving performance in a U2 system.
If you have any you want added, please send them to ‘u2tech’ at ‘y7mail.com’.
Use DIMensioned Arrays where possible
In general, you should use a dimensioned array in preference to a dynamic array. If you know the maximum number of elements or can reasonably pre-calculate the size required, you can see significant speed differences.
We took a 30 minute and growing nightly update process and reduced it to a mere 2 minutes by pre-processing some data to determine an array size and converting it to use dimensioned arrays. Plenty of other stories are out there of similar experiences.
Please, don’t be lazy. Spend the extra 30 seconds and do it right the first time, or some other poor soul will have to come along 6 months – 5 years later and spend an hour doing it right once it becomes an issue…
Tip: If you use INCLUDEs with EQUATEs for every file, you could also create an EQUATE for the maximum number of attributes in the record so you can MATREAD and MATREADU the data in. This works fine unless you compile your programs in BASICTYPE P or R. In this instance, you must ensure that every program that has the include is recompiled if the maximum number of attributes is increase otherwise the program could crash.
Use REMOVE with dynamic arrays
If you are sequentially processing subvalues, multivalues and (only in UniData) attributes, you should look into using the REMOVE command. Using REMOVE can give you substantial performance improvements, especially when working with large data-sets.
You can read more about this over at PickWiki which is from where I discovered it when I started with UniData.
Order the data in your records smartly
That’s right, the order of data in your records matters. Placing more frequently used data earlier in the record can reduce processing time. For more information see my article ‘Optimising the set up of your UniData data [Part 1]‘
INDEX fields where appropriate
Acquaint yourself with the commands ‘CREATE.INDEX’, ‘BUILD.INDEX’, ‘DISABLE.INDEX’, ‘ENABLE.INDEX’ and ‘LIST.INDEX’
Don’t forget that if your program is doing a bulk update on a file, you can save a lot of time by disabling the index before you update, then enable and build it again after you have finished