As has been mentioned, UV optimizes for sequential processing of @AM
delimited lists, thus greatly reducing the need for REMOVE and SELECT TO
type work-arounds. Not mentioned: SWAP is virtually instantaneous. Whatever
is causing the OP's process to slow down, it is not the FOR/NEXT <N>
construct, nor the SWAPs.
Here is a quick program that builds a 100,000 attribute array with two
values per attribute and then reads every attribute & value. The whole thing
(build then read) runs in less than two seconds.
Note that I first tested it by building LIST as
FOR N = 1 TO MAX
LIST<N> = XXX
NEXT N
Which really did really slow down as it grew.
But using LIST := @AM:XXX produced the speedy result documented below.
/Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006
>RUN BP SB
BUILDING...
START: 63682.6225
END: 63683.5232
ELAPSED: 0.9007 <-- less than 1 second to build 100,000 attributes
SIZE: 1277790
DCOUNT: 100001
READING...
START: 63683.5428
END: 63683.7975
ELAPSED: 0.2547 <-- about 1/4 sec to read and swap @vm to @am on 100,000
attributes.
>.L RELLEVEL
RELLEVEL
001 X
002 10.1.4
003 PICK
004 PICK.FORMAT
005 10.1.4
>
>CT BP SB
SB
0001 *array processing test
0002 MAX = 100000
0003 A0 = @(0)
0004 CL = @(-4)
0005
0006 T1 = TIME()
0007 PRINT "BUILDING..."
0008 PRINT "START: ":T1
0009 LIST = ""
0010 FOR N = 1 TO MAX
0011 REC = N
0012 REC<1,-1> = N*10
0013 LIST := @AM:REC
0014 IF MOD(N,1000) EQ 0 THEN PRINT A0:N:CL:
0015 NEXT N
0016 T2 = TIME()
0017 PRINT A0:"END: ":T2:CL
0018 PRINT "ELAPSED: ":T2-T1
0019
0020 PRINT
0021 PRINT "SIZE: ":LEN(LIST)
0022 PRINT "DCOUNT: ":DCOUNT(LIST,@AM)
0023 PRINT
0024
0025 PRINT "READING..."
0026 T1 = TIME()
0027 PRINT "START: ":T1
0028 FOR N = 1 TO MAX
0029 REC = LIST<N>
0030 CONVERT @VM TO @AM IN REC
0031 THING1 = REC<1>
0032 THING2 = REC<2>
0033 IF MOD(N,1000) EQ 0 THEN PRINT A0:N:CL:
0034 NEXT N
0035 T2 = TIME()
0036 PRINT A0:"END: ":T2:CL
0037 PRINT "ELAPSED: ":T2-T1
0038
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/