Nope; Has to do with how systems handle system delimiters. Dynamic arrays maintain pointers to attribute locations, but not the @VM pointers. The system already has buffering, memory management etc. for string manipulation.
However, what makes it fast is the routine makes use of 1,000 different memory locations, each being vastly smaller than the final resulting record. Each element of the array is smaller string, resulting in less paging, heap manipulation etc. The following example uses ONE variable instead of the previous 1000; Execution time is 21.735 seconds compared to the prior version: 3.75 seconds 01: D.ARRAY="" ; START.TIME=TIME() 02: FOR PTR=1 TO 1000000 03: GOSUB H.ADD ; * add to array 04: ! IF NOT(MOD(PTR,1000)) THEN CRT PTR 05: NEXT PTR 06: GOSUB H.RESULT 07: END.TIME=TIME() 08: CRT END.TIME, START.TIME, END.TIME-START.TIME 09: STOP 10: ********** 11: H.ADD:* add to array 12: ********** 13: D.ARRAY<-1>=PTR 14: * 15: RETURN 16: ********** 17: H.RESULT:* construct resulting array 18: ********** 19: D.ARRAY=CHANGE(D.ARRAY,@AM,@VM) 20: * 21: RETURN 22: * 23: * end of job 24: * 25: END . 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 Daniel McGrath Sent: Thursday, July 12, 2012 3:20 PM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) You are probably thinking about the technique of pre-allocating the chunk of memory first, then manually overwriting sections instead of appending to the end. This saves on system calls to allocate new memory. I think there used to be something on pick wiki about it. Regards, Dan -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David L. Wasylenko Sent: Thursday, July 12, 2012 12:58 PM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) I recall using attributes can be faster... This ran in 4.297 seconds with the display AND 3.75 without the progress display. But it took 24.656 seconds using @VM as delimiter. 01: DIM BIG(1000) ; MAT BIG="" 02: D.ARRAY="" ; START.TIME=TIME() 03: FOR PTR=1 TO 1000000 ;* one million 04: GOSUB H.ADD ; * add to array 05: IF NOT(MOD(PTR,1000)) THEN CRT PTR ;* progress display 06: NEXT PTR 07: GOSUB H.RESULT 08: END.TIME=TIME() 09: CRT END.TIME, START.TIME, END.TIME-START.TIME 10: STOP 11: ********** 12: H.ADD:* add to array 13: ********** 14: SEG.PTR=MOD(PTR,1000)+1 15: BIG(SEG.PTR)<-1>=PTR ;* alternate BIG(SEG.PTR)<1,-1>=PTR 16: * 17: RETURN 18: ********** 19: H.RESULT:* construct resulting array 20: ********** 21: MATBUILD RESULT FROM BIG USING @AM 22: MV.RESULT=CHANGE(RESULT,@AM,@VM) 23: * 24: RETURN 25: * 26: * end of job 27: * 28: END . 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 Daniel McGrath Sent: Thursday, July 12, 2012 1:50 PM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) Yes, exactly. If you starting breaking down what would be happening behind the scenes, you can see why X<-1>=I will be faster than X:= @AM:I will be faster than := X:@AM:I Hint, it is all about memory management, temporary variables, individual byte code ops and big O complexity (not necessarily in that order). -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David A. Green Sent: Thursday, July 12, 2012 10:25 AM To: 'U2 Users List' Subject: Re: [U2] trimming a list (a test of your ability) Ah, but try it with := instead of Y = Y: David A. Green (480) 813-1725 DAG Consulting -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Daniel McGrath Sent: Thursday, July 12, 2012 8:56 AM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) ROUNDS = 10000 LOOP X = '' ; Y = '' START.TIME = TIME() FOR I = 1 TO ROUNDS X<-1> = I NEXT I END.TIME = TIME() CRT END.TIME-START.TIME : " vs " : START.TIME = TIME() FOR I = 1 TO ROUNDS Y = Y:CHAR(254):I NEXT I END.TIME = TIME() CRT END.TIME-START.TIME ROUNDS *= 2 REPEAT ---- Results suggest that you should od <-1>, not the multiple concatenation. Dan McGrath Product Manager Rocket Software 4600 S. Ulster Street ..Suite 1100 ..Denver, CO 80237 . USA t: +1.720.475.8098 . m: +1.617.630.7392 . e:dmcgr...@rocketsoftware.com w: rocketsoftware.com/u2 -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Thursday, July 12, 2012 7:30 AM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) Instead of <-1>, use string=string:char(254):additionalelement George -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma Sent: Thursday, July 12, 2012 9:20 AM To: Marco Manyevere; U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) This is the best solution, using REMOVE and building a new list instead of constantly 'shrinking' the original table. That being said, as NEW.LIST gets rather large, adding new elements to it can get 'time' consuming. Just like the REMOVE keeps track of the pointer as you spin through a table, I wish there was a comparable statement that kept track of the pointer as we added new elements <-1> to tables. Sincerely, David Laansma IT Manager Hubbard Supply Co. Direct: 810-342-7143 Office: 810-234-8681 Fax: 810-234-6142 www.hubbardsupply.com "Delivering Products, Services and Innovative Solutions" -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Marco Manyevere Sent: Thursday, July 12, 2012 4:14 AM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) Is this what the OP is asking about or I'm missing something? The 2 code fragments look totally different. We dont know what's happening in GET.UTILITY.RECORD or the significance of UTILITY.NAME and LAST.NAME to totally eliminate them during the 'optimisation' I would rather do: NEW.LIST = '' LOOP REMOVE UTILITY.ID FROM KEY.LIST SETTING MORE WHILE MORE:UTILITY.ID GOSUB GET.UTILITY.RECORD IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN CONTINUE NEW.LIST<-1> = UTILITY.ID REPEAT KEY.LIST = NEW.LIST NEW.LIST = '' ;* free the memory ________________________________ From: Kate Stanton <k...@walstan.com> To: U2 Users List <u2-users@listserver.u2ug.org> Sent: Thursday, 12 July 2012, 4:27 Subject: Re: [U2] trimming a list (a test of your ability) I am getting sucked in! NLST = "" ;* For new list MAXI = DCOUNT(KEY.LIST<1>,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST<1,INO> ;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST<1,POS> ;* Sort to list END NEXT INO ;* Check all keys On 12 July 2012 12:09, Wjhonson <wjhon...@aol.com> wrote: > > 1295 FOR DISPLAY.LOOP = 1 TO KEY.COUNT > 1296 UTILITY.ID = KEY.LIST<1,DISPLAY.LOOP> > 1297 GOSUB GET.UTILITY.RECORD > 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN > 1299 KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) > 1300 DISPLAY.LOOP -= 1 > 1301 KEY.COUNT -= 1 > 1302 END > 1303 NEXT DISPLAY.LOOP > > > Comments? > > > _______________________________________________ > U2-Users mailing list > U2-Users@listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > -- Kate Stanton Walstan Systems Ltd 4 Kelmarna Ave, Herne Bay, Auckland 1011, New Zealand Phone: + 64 9 360 5310 Mobile: + 64 21 400 486 Email: k...@walstan.com _______________________________________________ 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 _______________________________________________ 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 _______________________________________________ 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