I beg to differ. The runtime maintains a pointer to *your current attribute*, as I understand it.
Not to *each* attribute location. One buffer location, not a thousand. If it maintained a pointer to *each* attribute location, you could jump around in the variable at random and has access as quick as a dimensioned array gives you. But I believe that is not the case. By-attribute insertion is quick *only* because you are always inserting at the current position (or the next). Change this to a locate with insertion and it should dramatically slow down. This is because the entire string is being picked up and put down on each insert. The whole string. I think in the case of insertion at the end (the current position) it doesn't actually pick up and rewrite the whole string on each append. Just the end of the string. -----Original Message----- From: David L. Wasylenko <d...@pickpro.com> To: U2 Users List <u2-users@listserver.u2ug.org> Sent: Thu, Jul 12, 2012 2:09 pm Subject: Re: [U2] trimming a list (a test of your ability) Nope; as to do with how systems handle system delimiters. ynamic arrays maintain pointers to attribute locations, but not the @VM ointers. he system already has buffering, memory management etc. for string anipulation. However, what makes it fast is the routine makes use of 1,000 different memory ocations, ach being vastly smaller than the final resulting record. Each element of the array is smaller string, resulting in less paging, heap anipulation etc. The following example uses ONE variable instead of the previous 1000; xecution time is 21.735 seconds compared to the prior version: 3.75 seconds 01: D.ARRAY="" ; START.TIME=TIME() 2: FOR PTR=1 TO 1000000 3: GOSUB H.ADD ; * add to array 4: ! IF NOT(MOD(PTR,1000)) THEN CRT PTR 5: NEXT PTR 6: GOSUB H.RESULT 7: END.TIME=TIME() 8: CRT END.TIME, START.TIME, END.TIME-START.TIME 9: STOP 0: ********** 1: H.ADD:* add to array 2: ********** 3: D.ARRAY<-1>=PTR 4: * 5: RETURN 6: ********** 7: H.RESULT:* construct resulting array 8: ********** 9: D.ARRAY=CHANGE(D.ARRAY,@AM,@VM) 0: * 1: RETURN 2: * 3: * end of job 4: * 5: END david . David L. Wasylenko resident, Pick Professionals, Inc ) 314 558 1482 l...@pickpro.com ----Original Message----- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of Daniel McGrath ent: Thursday, July 12, 2012 3:20 PM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) You are probably thinking about the technique of pre-allocating the chunk of emory first, then manually overwriting sections instead of appending to the nd. This saves on system calls to allocate new memory. I think there used to be omething on pick wiki about it. Regards, an -----Original Message----- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of David L. Wasylenko ent: Thursday, July 12, 2012 12:58 PM o: U2 Users List ubject: 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 isplay AND 3.75 without the progress display. ut it took 24.656 seconds using @VM as delimiter. 01: DIM BIG(1000) ; MAT BIG="" 2: D.ARRAY="" ; START.TIME=TIME() 3: FOR PTR=1 TO 1000000 ;* one million 4: GOSUB H.ADD ; * add to array 5: IF NOT(MOD(PTR,1000)) THEN CRT PTR ;* progress display 6: NEXT PTR 7: GOSUB H.RESULT 8: END.TIME=TIME() 9: CRT END.TIME, START.TIME, END.TIME-START.TIME 0: STOP 1: ********** 2: H.ADD:* add to array 3: ********** 4: SEG.PTR=MOD(PTR,1000)+1 5: BIG(SEG.PTR)<-1>=PTR ;* alternate BIG(SEG.PTR)<1,-1>=PTR 6: * 7: RETURN 8: ********** 9: H.RESULT:* construct resulting array 0: ********** 1: MATBUILD RESULT FROM BIG USING @AM 2: MV.RESULT=CHANGE(RESULT,@AM,@VM) 3: * 4: RETURN 5: * 6: * end of job 7: * 8: END david . David L. Wasylenko resident, Pick Professionals, Inc ) 314 558 1482 l...@pickpro.com ----Original Message----- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of Daniel McGrath ent: Thursday, July 12, 2012 1:50 PM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) es, exactly. If you starting breaking down what would be happening behind the cenes, you can see why X<-1>=I will be faster than X:= @AM:I will be faster han := X:@AM:I Hint, it is all about memory management, temporary variables, individual byte ode ops and big O complexity (not necessarily in that order). -----Original Message----- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of David A. Green ent: Thursday, July 12, 2012 10:25 AM o: 'U2 Users List' ubject: 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 AG Consulting -----Original Message----- rom: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Daniel McGrath ent: Thursday, July 12, 2012 8:56 AM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) ROUNDS = 10000 OOP 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 EPEAT ---- Results suggest that you should od <-1>, not the multiple concatenation. Dan McGrath roduct Manager ocket Software 600 S. Ulster Street ..Suite 1100 ..Denver, CO 80237 . USA : +1.720.475.8098 . m: +1.617.630.7392 . e:dmcgr...@rocketsoftware.com w: ocketsoftware.com/u2 -----Original Message----- rom: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen ent: Thursday, July 12, 2012 7:30 AM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) Instead of <-1>, use string=string:char(254):additionalelement George -----Original Message----- rom: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma ent: Thursday, July 12, 2012 9:20 AM o: Marco Manyevere; U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) This is the best solution, using REMOVE and building a new list instead of onstantly 'shrinking' the original table. That being said, as NEW.LIST gets rather large, adding new elements to it can et 'time' consuming. Just like the REMOVE keeps track of the pointer as you pin through a table, I wish there was a comparable statement that kept track of he pointer as we added new elements <-1> to tables. Sincerely, avid Laansma T Manager ubbard Supply Co. irect: 810-342-7143 ffice: 810-234-8681 ax: 810-234-6142 ww.hubbardsupply.com Delivering Products, Services and Innovative Solutions" -----Original Message----- rom: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Marco Manyevere ent: Thursday, July 12, 2012 4:14 AM o: U2 Users List ubject: 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 ragments look totally different. We dont know what's happening in ET.UTILITY.RECORD or the significance of UTILITY.NAME and LAST.NAME to totally liminate them during the 'optimisation' I would rather do: EW.LIST = '' OOP 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 EPEAT EY.LIST = NEW.LIST EW.LIST = '' ;* free the memory ________________________________ From: Kate Stanton <k...@walstan.com> o: U2 Users List <u2-users@listserver.u2ug.org> ent: Thursday, 12 July 2012, 4:27 ubject: Re: [U2] trimming a list (a test of your ability) am getting sucked in! NLST = "" ;* For new list AXI = 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 EXT INO ;* Check all keys n 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 -- ate Stanton alstan Systems Ltd Kelmarna Ave, Herne Bay, Auckland 1011, New Zealand hone: + 64 9 360 5310 Mobile: + 64 21 400 486 mail: k...@walstan.com ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________ 2-Users mailing list 2-us...@listserver.u2ug.org ttp://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users