Here's a quick proggy I've scrudged together to get a rough indication -
results on my system are:
Dynamic Dimensioned
Read/random access 18.4 14.2
Read only 3.9 4.6
This is with small records: obviously with larger ones the gaps should
widen.
Brian
PROGRAM testdim
DIM SALESREC(10)
Open 'BOOK_SALES' To F.SALES Else STOP
* Ignore the first run as it loads the file into memory
Crt "First dummy run"
Fin = @False
Select F.SALES
Loop
ReadNext Id Else Fin = @True
Until Fin Do
Read SalesRec From F.SALES, Id Else Null
Repeat
* Now the real one, read and randomly access fields
Crt "Dynamic Array"
Now = Time()
For I = 1 To 100
Fin = @False
Select F.SALES
Loop
ReadNext Id Else Fin = @True
Until Fin Do
Read SalesRec From F.SALES, Id Else
SalesRec = ''
End
For J = 1 To 100
Attr = Rnd(9) + 1
Temp = SalesRec<Attr>
Next
Repeat
Next
Crt "Time taken : ": (Time() - Now)
Crt "Dimensioned Array"
Now = Time()
For I = 1 To 100
Fin = @False
Select F.SALES
Loop
ReadNext Id Else Fin = @True
Until Fin Do
MatRead SALESREC From F.SALES, Id Else
Mat SALESREC = ''
End
For J = 1 To 100
Attr = Rnd(9) + 1
Temp = SALESREC(Attr)
Next
Repeat
Next
Crt "Time taken : ": (Time() - Now)
* Now just read overheads no access to fields
Crt "Dynamic Array Read Only"
Now = Time()
For I = 1 To 100
Fin = @False
Select F.SALES
Loop
ReadNext Id Else Fin = @True
Until Fin Do
Read SalesRec From F.SALES, Id Else
SalesRec = ''
End
Repeat
Next
Crt "Time taken : ": (Time() - Now)
Crt "Dimensioned Array Read Only"
Now = Time()
For I = 1 To 100
Fin = @False
Select F.SALES
Loop
ReadNext Id Else Fin = @True
Until Fin Do
MatRead SALESREC From F.SALES, Id Else
Mat SALESREC = ''
End
Repeat
Next
Crt "Time taken : ": (Time() - Now)
STOP
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: 27 July 2012 16:24
To: U2 Users List
Cc: U2 Users List
Subject: Re: [U2] Array Types
I understand the performance trade off between dynamic and dimensioned
arrays but I'm curious about quantifying.
I know the answer will depend on hardware and load, but in general at what
point (length) do dimensioned arrays become better performing than dynamic?
1000?
10000?
100000?
Any examples or benchmarks appreciated.
Jeff Butera
Sent from my iPhone
On Jul 27, 2012, at 11:14 AM, "David L. Wasylenko" <[email protected]> wrote:
> Speed
> There is a *long* thread here demonstrating the difference between *DAYS*
of processing and seconds, using large records for demonstration.
>
> ... david ...
>
> David L. Wasylenko
> President, Pick Professionals, Inc
> w) 314 558 1482
> [email protected]
>
>
> -----Original Message-----
> From: [email protected]
[mailto:[email protected]] On Behalf Of Bill Brutzman
> Sent: Friday, July 27, 2012 10:16 AM
> To: U2 Users List
> Subject: [U2] Array Types
>
> I am surprised that anyone uses dimensioned arrays. I use dynamic arrays
for everything.
>
> If there are any advantages that dimension arrays have over dynamic...
please let me know... without getting sentimental.
>
> --Bill
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users