Kbase P16482: OPEN CLIENT: Performance Tuning Tip for Output Temp-Tables
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  29/01/2003 |
|
Status: Unverified
GOAL:
OPEN CLIENT: Performance Tuning Tip for Output Temp-Tables
FACT(s) (Environment):
Progress 9.1x
FIX:
When writing a piece of 4GL code which will be accessed via the Open Client Toolkit and which returns an temp-table it is always a good idea to also define an output parameter which returns back the number of records in the temp-table.
This information can be put to good use on the client side by allowing you to "size" the object you are going to be using to store the data which you retrieve from the temp-table.
For instance, it is common in Java to store this information in a vector.
By default a new vector will allocate enough space to hold ten (10) objects.
Each new object added to the vector beyond the first ten will cause a new vector to be created that has a size of "old vector size + 1".
Once the new vector is allocated Java must copy all of the objects from the old vector to the new one.
Depending on how many records are involved this can become quite a time and resource consuming task.
By returning the number of records in the temp-table you can preallocate the vector with an initial size that exactly matches your needs (thereby saving considerable time and resources).
The same rule applies in Visual Basic when storing the data in a variant array. The ReDim statement can be used to resize the array to the proper size required to hold the data and avoid time and resource consuming reallocations.