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: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of
jbut...@hampshire.edu
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" <d...@pickpro.com> 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
> d...@pickpro.com
> 
> 
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] 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
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to