Charles Stevenson says:
[snipped a bunch of good stuff]
>If you have a program that manipulates many attributes many times, then
>it makes sense to matread them into a dimensioned array up front, and
>matwrite them in the end, thereby limiting big string manipulations.
>People forget or newbies don't know that CUST.REC<117> is really
>EXTRACT( CUST.REC, 117,0,0) or REPLACE(...,CUST.REC,117,0,0).  That can
>be very expensive when you do that for many attributes many times, with
>large dynamic arrays.   By contrast, each dimensioned array element has
>its own memory address, so references and assignments can jump straight
>to it.

Good point! Large dynamic arrays take longer to perform insertions,
deletions and replacements. Why? The whole record must be copied to a new
memory location with the changes. With dimensioned arrays, only the affected
element is manipulated. Another related and fundamental difference exists
between the two array types that should not be overlooked. 

The dynamic array can only store string data. Numeric values convert to a
string before being stored in a dynamic array. Subsequent extraction of that
just-stored data returns as a string and converts back to numeric as
necessary. However, each dimensioned array element has its own unique memory
descriptor (variable). A dynamic array element may store any type of data
(though only string or numeric is appropriate for records). By using
dimensioned arrays, numeric values are stored in the array without
conversion. The conversion from numeric to string occurs only once, at the
point when writing the record. Using dimensioned arrays can improve
throughput when repeatedly performing mathematical operations on record
elements. 

Best regards,
Gyle

P.S. I designed the URMA run machine to treat dynamic arrays as though they
were dimensioned arrays internally, providing direct access any field, value
or sub-value. Accessing record<1000, 1000, 1000> is nearly as fast as
accessing record<1, 1, 1>. I believe Robert Colquhoun took a similar
approach with MaVerick too. Do not expect U2 to do anything like this
anytime soon. The descriptor management foundation needs to support this
concept and is not easily retrofitted.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to