Re: [U2] trimming a list (a test of your ability)
Universe gives a slight lead to -1 too. Also, it compiles Y = Y:CHAR(254):I and Y := CHAR(254):I to exactly the same thing. I checked with VLIST and even edited the compiled code to be sure. ALSO (and this surprised me) it doesn't support ROUNDS *= 2 The documenation (Universe BASIC 2-25) only shows plus-equal minus-equal and concatenate-equal so I suppose that must be correct. I'm still a little shell-shocked, though. Regards, Keith ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] trimming a list (a test of your ability)
Just a thought.. If it's THAT big, might be quicker to actually write to a sequential file if you're on an OS that maps /tmp to memory like Solaris can (version dependent?). But I ain't got a Solaris box to test that theory. Brian -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David L. Wasylenko Sent: 12 July 2012 23:09 To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) JUST FOR FUN... I bumped the iteration count to 10,000,000 And the DIM BIG() to 10,000 Ran in 60 seconds with 157,094 to 355,618 iterations per second. Total byte count of the resulting @MV list was 78,888,896 bytes NOT too shabby ... 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 David L. Wasylenko Sent: Thursday, July 12, 2012 4:57 PM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) Not exactly. Current position of EACH unique variable... And a DIM BIG(1000) has/is 1,000 unique variables. So 1,000 unique pointers. And the writing whole string --- yes it would, if the size outstrips the memory allocated. By using 1,000 smaller strings, the move is triggered much less often, allowing the append operation VS reallocation of a new, larger memory buffer. With REC-1 or REC1,-1 syntax: Using a *single* variable, 1,000,000 iterations: @am delimited = 21.719 seconds, ranging from 41,545 iterations a second to 45,161, very consistant @vm delimited = ( Had to stop it at 100,000 iterations, 235.561 seconds) from 12,787 iterations a second at start down to 449 per sec at 100,000 values, consistently slower and slower Just using REC-1 saved a HUGE amount of time. Using a DIM(1000) variable: @vm delimited = 24.859 seconds 39,553 to 317,460 per second; wide swing but much faster than a single variable @am delimited = 3.781 seconds245,158 to 425,531 per second; the big winner The @VM delimiter will continually get slower and slower using either method, however, the slowdown occurs only 1,000 times. So in either case, the savings is significant using @AM - the DIM() concept is icing and the best method I've seen. ... 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 Wjhonson Sent: Thursday, July 12, 2012 4:16 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] trimming a list (a test of your ability) 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 100 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
Re: [U2] trimming a list (a test of your ability)
You must do WHILE MORE:NEXT.ID or WHILE NEXT.ID:MORE otherwise the last NEXT.ID will not be processed From: dennis bartlett dqbartl...@gmail.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Friday, 13 July 2012, 7:09 Subject: Re: [U2] trimming a list (a test of your ability) Hi Steven The REMOVE statement process a multivalued list. The SETTING clause will set the variable to either 3, or 2, or 1, or 0 depending on the value of the delimiter last encountered... 1 for @FM 2 for @VM 3 for @SM 0 for End Of String If the array consists only of @FM, then MORE will be set to 1 for each iteration (since the delimiter it is encountering each time is an @FM) and then, when the last element is read, MORE will be set to ZERO, and the WHILE MORE will fail, thus the loop is exited. If FM.ARRAY is empty, MORE will return as 0 and the loop will exit, but you're right - the WHILE MORE line should be one line higher.. UNIQ.LIST = '' LOOP REMOVE NEXT.ID http://next.id/ FROM FM.ARRAY SETTING MORE WHILE MORE LOCATE(NEXT.ID http://next.id/,UNIQ.LIST,1;POS) ELSE UNIQ.LIST-1 = NEXT.ID http://next.id/ REPEAT the WHILE statement is in effect a while it is not zero and the second it becomes a zero, the loop exits. ___ 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
Re: [U2] trimming a list (a test of your ability)
On 12/07/12 16:15, Dave Laansma wrote: I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or another. Except that a string, as far as I am aware, uses the pascal method I think it's called - namely a string is stored as its length followed by the string (or a Hollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to a 'string' faster than -1? Very much so And if so, why doesn't the database use the same logic for -1 as it does for := since technically they're accomplishing the same thing? Because it's doing it in a completely different way. The -1 logic just happens to work whereas the append logic was designed to work that way. If you use a field number, the code searches for that field - I think it takes the field as a counter, and searches the string decrementing the counter every time it hits a field mark. When the counter hits zero it's found what it's looking for. Of course, if you start at -1, it never hits zero and ends up at the end of the string. But this is by accident not design. To do what you suggest would require special case code which doesn't - logically - belong there. 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 Cheers, Wol ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] trimming a list (a test of your ability)
Yes/No A string is stored in a fixed length *spot*, and is ended by an FF. This is *why* if you actually try to create a string in BASIC (or read one) with an embedded FF in it, the runtime will truncate the string It doesn' actually truncate the variable spot, what it does is fool the run-time into thinking you've hit the end of the string so it ignores anything else after it thinking it's leftover garbage from trimming or something. So initially let's say you get a spot of 8 bytes which is the default size of any variable, if you're string is only 8, it will then allocate you 50 bytes, and *move* the string into that new spot and the old spot will just be a direct pointer to the new spot. If you exceed 50 bytes, it then *allocates* you a new *spot* of 250 bytes elsewhere, and the original 8 byte spot now points at the new spot And so on. However, as it scans the string looking for the *end*, if it encounters an FF, that's the end. The run-time will also garbage-collect the old spots by the way, for use as other things. I'd be surprised if it actually wastes effort to store the length constantly at the fore, but I'm willing to be edumacated on that abstruse point. (Or pointer) Will -Original Message- From: Wols Lists antli...@youngman.org.uk To: u2-users u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 3:53 am Subject: Re: [U2] trimming a list (a test of your ability) On 12/07/12 16:15, Dave Laansma wrote: I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or another. Except that a string, as far as I am aware, uses the pascal method I hink it's called - namely a string is stored as its length followed by he string (or a Hollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to a 'string' faster than -1? Very much so And if so, why doesn't the database use the same logic for -1 as it does for := since technically they're accomplishing the same thing? ecause it's doing it in a completely different way. The -1 logic just happens to work whereas the append logic was designed to work hat way. If you use a field number, the code searches for that field - I think it akes the field as a counter, and searches the string decrementing the ounter every time it hits a field mark. When the counter hits zero it's ound what it's looking for. Of course, if you start at -1, it never hits zero and ends up at the end f the string. But this is by accident not design. To do what you uggest would require special case code which doesn't - logically - elong there. 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 heers, ol __ 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
Re: [U2] trimming a list (a test of your ability)
Interesting but I think each time you do a LOCATE it must scan the entire string from front to back. I think on very large lists, you might see a speed improvement if you sort, append and then do a backward walk to remove dups. Of course that's much more complicated. -Original Message- From: dennis bartlett dqbartl...@gmail.com To: Marco Manyevere mmanyev...@yahoo.com; U2 Users List u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 7:59 am Subject: Re: [U2] trimming a list (a test of your ability) Actually the way I wrote it the first time was correct but I needed to test or null x's i.e. z='' oop remove x from y setting more if x ne '' then locate (...) else z := x:@fm end hile more epeat On 13 July 2012 19:30, Marco Manyevere mmanyev...@yahoo.com wrote: You must do WHILE MORE:NEXT.ID or WHILE NEXT.ID:MORE otherwise the last NEXT.ID will not be processed From: dennis bartlett dqbartl...@gmail.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Friday, 13 July 2012, 7:09 Subject: Re: [U2] trimming a list (a test of your ability) Hi Steven The REMOVE statement process a multivalued list. The SETTING clause will set the variable to either 3, or 2, or 1, or 0 depending on the value of the delimiter last encountered... 1 for @FM 2 for @VM 3 for @SM 0 for End Of String If the array consists only of @FM, then MORE will be set to 1 for each iteration (since the delimiter it is encountering each time is an @FM) and then, when the last element is read, MORE will be set to ZERO, and the WHILE MORE will fail, thus the loop is exited. If FM.ARRAY is empty, MORE will return as 0 and the loop will exit, but you're right - the WHILE MORE line should be one line higher.. UNIQ.LIST = '' LOOP REMOVE NEXT.ID http://next.id/ FROM FM.ARRAY SETTING MORE WHILE MORE LOCATE(NEXT.ID http://next.id/,UNIQ.LIST,1;POS) ELSE UNIQ.LIST-1 = NEXT.ID http://next.id/ REPEAT the WHILE statement is in effect a while it is not zero and the second it becomes a zero, the loop exits. ___ 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 __ 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
Re: [U2] trimming a list (a test of your ability)
For universe, I believe that used to be true - I seem to recall running into this maybe 15+(?) years ago. I also seem to recall that the resolution to this issue was, as was mentioned, prepending all strings with a length. Try it: x=abc:char(255):xyz crt [:x:] crt len(x) crt index(x,x,1) end [abc xyz] 7 5 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Friday, July 13, 2012 12:27 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] trimming a list (a test of your ability) Yes/No A string is stored in a fixed length *spot*, and is ended by an FF. This is *why* if you actually try to create a string in BASIC (or read one) with an embedded FF in it, the runtime will truncate the string It doesn' actually truncate the variable spot, what it does is fool the run-time into thinking you've hit the end of the string so it ignores anything else after it thinking it's leftover garbage from trimming or something. So initially let's say you get a spot of 8 bytes which is the default size of any variable, if you're string is only 8, it will then allocate you 50 bytes, and *move* the string into that new spot and the old spot will just be a direct pointer to the new spot. If you exceed 50 bytes, it then *allocates* you a new *spot* of 250 bytes elsewhere, and the original 8 byte spot now points at the new spot And so on. However, as it scans the string looking for the *end*, if it encounters an FF, that's the end. The run-time will also garbage-collect the old spots by the way, for use as other things. I'd be surprised if it actually wastes effort to store the length constantly at the fore, but I'm willing to be edumacated on that abstruse point. (Or pointer) Will -Original Message- From: Wols Lists antli...@youngman.org.uk To: u2-users u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 3:53 am Subject: Re: [U2] trimming a list (a test of your ability) On 12/07/12 16:15, Dave Laansma wrote: I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or another. Except that a string, as far as I am aware, uses the pascal method I hink it's called - namely a string is stored as its length followed by he string (or a Hollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to a 'string' faster than -1? Very much so And if so, why doesn't the database use the same logic for -1 as it does for := since technically they're accomplishing the same thing? ecause it's doing it in a completely different way. The -1 logic just happens to work whereas the append logic was designed to work hat way. If you use a field number, the code searches for that field - I think it akes the field as a counter, and searches the string decrementing the ounter every time it hits a field mark. When the counter hits zero it's ound what it's looking for. Of course, if you start at -1, it never hits zero and ends up at the end f the string. But this is by accident not design. To do what you uggest would require special case code which doesn't - logically - elong there. 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 heers, ol __ 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 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] trimming a list (a test of your ability)
Just to be complete : for j=0 to 255 if char(j)='x' then continue x=abc:char(j):xyz l=len(x) p=index(x,x,1) if j=0 or l#7 or p#5 then crt j=:j crt x =[:x:] crt len=:l crt pos=:p end next end j=0 x =[abcxyz] len=7 pos=5 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of u2ug Sent: Friday, July 13, 2012 1:10 PM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) For universe, I believe that used to be true - I seem to recall running into this maybe 15+(?) years ago. I also seem to recall that the resolution to this issue was, as was mentioned, prepending all strings with a length. Try it: x=abc:char(255):xyz crt [:x:] crt len(x) crt index(x,x,1) end [abc xyz] 7 5 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Friday, July 13, 2012 12:27 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] trimming a list (a test of your ability) Yes/No A string is stored in a fixed length *spot*, and is ended by an FF. This is *why* if you actually try to create a string in BASIC (or read one) with an embedded FF in it, the runtime will truncate the string It doesn' actually truncate the variable spot, what it does is fool the run-time into thinking you've hit the end of the string so it ignores anything else after it thinking it's leftover garbage from trimming or something. So initially let's say you get a spot of 8 bytes which is the default size of any variable, if you're string is only 8, it will then allocate you 50 bytes, and *move* the string into that new spot and the old spot will just be a direct pointer to the new spot. If you exceed 50 bytes, it then *allocates* you a new *spot* of 250 bytes elsewhere, and the original 8 byte spot now points at the new spot And so on. However, as it scans the string looking for the *end*, if it encounters an FF, that's the end. The run-time will also garbage-collect the old spots by the way, for use as other things. I'd be surprised if it actually wastes effort to store the length constantly at the fore, but I'm willing to be edumacated on that abstruse point. (Or pointer) Will -Original Message- From: Wols Lists antli...@youngman.org.uk To: u2-users u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 3:53 am Subject: Re: [U2] trimming a list (a test of your ability) On 12/07/12 16:15, Dave Laansma wrote: I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or another. Except that a string, as far as I am aware, uses the pascal method I hink it's called - namely a string is stored as its length followed by he string (or a Hollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to a 'string' faster than -1? Very much so And if so, why doesn't the database use the same logic for -1 as it does for := since technically they're accomplishing the same thing? ecause it's doing it in a completely different way. The -1 logic just happens to work whereas the append logic was designed to work hat way. If you use a field number, the code searches for that field - I think it akes the field as a counter, and searches the string decrementing the ounter every time it hits a field mark. When the counter hits zero it's ound what it's looking for. Of course, if you start at -1, it never hits zero and ends up at the end f the string. But this is by accident not design. To do what you uggest would require special case code which doesn't - logically - elong there. 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 heers, ol __ 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 ___ 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
Re: [U2] trimming a list (a test of your ability)
Well I'll be a horned toad. However try this ED BP TESTFF 001 PRINT DOG:CHAR(255):CAT .^ Up arrow mode .R/DOG/DOG^255 001 PRINT DOG :CHAR(255):CAT .FI BASIC BP TESTFF No closing quote The compiler doesn't see the FF as the same sort of thing as other characters even if the editor does -Original Message- From: u2ug simpson-u...@gerzio.ca To: U2 Users List u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 10:43 am Subject: Re: [U2] trimming a list (a test of your ability) Just to be complete : for j=0 to 255 if char(j)='x' then continue x=abc:char(j):xyz l=len(x) p=index(x,x,1) if j=0 or l#7 or p#5 then crt j=:j crt x =[:x:] crt len=:l crt pos=:p end ext nd =0 x =[abcxyz] len=7 pos=5 -Original Message- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of u2ug ent: Friday, July 13, 2012 1:10 PM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) For universe, I believe that used to be true - I seem to recall running into his maybe 15+(?) years ago. also seem to recall that the resolution to this issue was, as was mentioned, repending all strings with a length. Try it: x=abc:char(255):xyz crt [:x:] crt len(x) crt index(x,x,1) nd [abc xyz] Original Message- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of Wjhonson ent: Friday, July 13, 2012 12:27 PM o: u2-users@listserver.u2ug.org ubject: Re: [U2] trimming a list (a test of your ability) es/No A string is stored in a fixed length *spot*, and is ended by an FF. his is *why* if you actually try to create a string in BASIC (or read one) with n embedded FF in it, the runtime will truncate the string It doesn' actually runcate the variable spot, what it does is fool the run-time into thinking ou've hit the end of the string so it ignores anything else after it thinking t's leftover garbage from trimming or something. So initially let's say you get a spot of 8 bytes which is the default size of ny variable, if you're string is only 8, it will then allocate you 50 bytes, nd *move* the string into that new spot and the old spot will just be a direct ointer to the new spot. If you exceed 50 bytes, it then *allocates* you a new *spot* of 250 bytes lsewhere, and the original 8 byte spot now points at the new spot And so on. However, as it scans the string looking for the *end*, if it encounters an FF, hat's the end. he run-time will also garbage-collect the old spots by the way, for use as ther things. I'd be surprised if it actually wastes effort to store the length constantly at he fore, but I'm willing to be edumacated on that abstruse point. (Or pointer) Will -Original Message- rom: Wols Lists antli...@youngman.org.uk o: u2-users u2-users@listserver.u2ug.org ent: Fri, Jul 13, 2012 3:53 am ubject: Re: [U2] trimming a list (a test of your ability) n 12/07/12 16:15, Dave Laansma wrote: I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or nother. xcept that a string, as far as I am aware, uses the pascal method I hink it's alled - namely a string is stored as its length followed by he string (or a ollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to a string' faster than -1? ery much so And if so, why doesn't the database use the same logic for -1 as it does for = since technically they're accomplishing the same thing? cause it's doing it in a completely different way. The -1 logic just happens o work whereas the append logic was designed to work hat way. f you use a field number, the code searches for that field - I think it akes he field as a counter, and searches the string decrementing the ounter every ime it hits a field mark. When the counter hits zero it's ound what it's ooking for. f course, if you start at -1, it never hits zero and ends up at the end f the tring. But this is by accident not design. To do what you uggest would require pecial case code which doesn't - logically - elong there. 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 eers, l _ -Users mailing list -us...@listserver.u2ug.org tp://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
Re: [U2] trimming a list (a test of your ability)
Yep - I've run into that at some time as well. I seem to remember this being a problem with the editor or with reading/writing values to an mv file rather than internal string handling. If you re-edit the source, do you find that it has been split into : 001 PRINT DOG 002 :CHAR(255):CAT ? -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Friday, July 13, 2012 1:49 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] trimming a list (a test of your ability) Well I'll be a horned toad. However try this ED BP TESTFF 001 PRINT DOG:CHAR(255):CAT .^ Up arrow mode .R/DOG/DOG^255 001 PRINT DOG :CHAR(255):CAT .FI BASIC BP TESTFF No closing quote The compiler doesn't see the FF as the same sort of thing as other characters even if the editor does -Original Message- From: u2ug simpson-u...@gerzio.ca To: U2 Users List u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 10:43 am Subject: Re: [U2] trimming a list (a test of your ability) Just to be complete : for j=0 to 255 if char(j)='x' then continue x=abc:char(j):xyz l=len(x) p=index(x,x,1) if j=0 or l#7 or p#5 then crt j=:j crt x =[:x:] crt len=:l crt pos=:p end ext nd =0 x =[abcxyz] len=7 pos=5 -Original Message- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of u2ug ent: Friday, July 13, 2012 1:10 PM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) For universe, I believe that used to be true - I seem to recall running into his maybe 15+(?) years ago. also seem to recall that the resolution to this issue was, as was mentioned, repending all strings with a length. Try it: x=abc:char(255):xyz crt [:x:] crt len(x) crt index(x,x,1) nd [abc xyz] Original Message- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of Wjhonson ent: Friday, July 13, 2012 12:27 PM o: u2-users@listserver.u2ug.org ubject: Re: [U2] trimming a list (a test of your ability) es/No A string is stored in a fixed length *spot*, and is ended by an FF. his is *why* if you actually try to create a string in BASIC (or read one) with n embedded FF in it, the runtime will truncate the string It doesn' actually runcate the variable spot, what it does is fool the run-time into thinking ou've hit the end of the string so it ignores anything else after it thinking t's leftover garbage from trimming or something. So initially let's say you get a spot of 8 bytes which is the default size of ny variable, if you're string is only 8, it will then allocate you 50 bytes, nd *move* the string into that new spot and the old spot will just be a direct ointer to the new spot. If you exceed 50 bytes, it then *allocates* you a new *spot* of 250 bytes lsewhere, and the original 8 byte spot now points at the new spot And so on. However, as it scans the string looking for the *end*, if it encounters an FF, hat's the end. he run-time will also garbage-collect the old spots by the way, for use as ther things. I'd be surprised if it actually wastes effort to store the length constantly at he fore, but I'm willing to be edumacated on that abstruse point. (Or pointer) Will -Original Message- rom: Wols Lists antli...@youngman.org.uk o: u2-users u2-users@listserver.u2ug.org ent: Fri, Jul 13, 2012 3:53 am ubject: Re: [U2] trimming a list (a test of your ability) n 12/07/12 16:15, Dave Laansma wrote: I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or nother. xcept that a string, as far as I am aware, uses the pascal method I hink it's alled - namely a string is stored as its length followed by he string (or a ollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to a string' faster than -1? ery much so And if so, why doesn't the database use the same logic for -1 as it does for = since technically they're accomplishing the same thing? cause it's doing it in a completely different way. The -1 logic just happens o work whereas the append logic was designed to work hat way. f you use a field number, the code searches for that field - I think it akes he field as a counter, and searches the string decrementing the ounter every ime it hits a field mark. When the counter hits zero it's ound what it's ooking for. f course, if you start at -1, it never hits zero and ends up at the end f the tring. But this is by accident not design. To do what you uggest would require pecial case code which doesn't - logically - elong there. 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 eers, l
Re: [U2] trimming a list (a test of your ability)
Oops - meant to say : I seem to remember this being a problem writing values to an mv file rather than internal string handling. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of u2ug Sent: Friday, July 13, 2012 2:54 PM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) Yep - I've run into that at some time as well. I seem to remember this being a problem with the editor or with reading/writing values to an mv file rather than internal string handling. If you re-edit the source, do you find that it has been split into : 001 PRINT DOG 002 :CHAR(255):CAT ? -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Friday, July 13, 2012 1:49 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] trimming a list (a test of your ability) Well I'll be a horned toad. However try this ED BP TESTFF 001 PRINT DOG:CHAR(255):CAT .^ Up arrow mode .R/DOG/DOG^255 001 PRINT DOG :CHAR(255):CAT .FI BASIC BP TESTFF No closing quote The compiler doesn't see the FF as the same sort of thing as other characters even if the editor does -Original Message- From: u2ug simpson-u...@gerzio.ca To: U2 Users List u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 10:43 am Subject: Re: [U2] trimming a list (a test of your ability) Just to be complete : for j=0 to 255 if char(j)='x' then continue x=abc:char(j):xyz l=len(x) p=index(x,x,1) if j=0 or l#7 or p#5 then crt j=:j crt x =[:x:] crt len=:l crt pos=:p end ext nd =0 x =[abcxyz] len=7 pos=5 -Original Message- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of u2ug ent: Friday, July 13, 2012 1:10 PM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) For universe, I believe that used to be true - I seem to recall running into his maybe 15+(?) years ago. also seem to recall that the resolution to this issue was, as was mentioned, repending all strings with a length. Try it: x=abc:char(255):xyz crt [:x:] crt len(x) crt index(x,x,1) nd [abc xyz] Original Message- rom: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] n Behalf Of Wjhonson ent: Friday, July 13, 2012 12:27 PM o: u2-users@listserver.u2ug.org ubject: Re: [U2] trimming a list (a test of your ability) es/No A string is stored in a fixed length *spot*, and is ended by an FF. his is *why* if you actually try to create a string in BASIC (or read one) with n embedded FF in it, the runtime will truncate the string It doesn' actually runcate the variable spot, what it does is fool the run-time into thinking ou've hit the end of the string so it ignores anything else after it thinking t's leftover garbage from trimming or something. So initially let's say you get a spot of 8 bytes which is the default size of ny variable, if you're string is only 8, it will then allocate you 50 bytes, nd *move* the string into that new spot and the old spot will just be a direct ointer to the new spot. If you exceed 50 bytes, it then *allocates* you a new *spot* of 250 bytes lsewhere, and the original 8 byte spot now points at the new spot And so on. However, as it scans the string looking for the *end*, if it encounters an FF, hat's the end. he run-time will also garbage-collect the old spots by the way, for use as ther things. I'd be surprised if it actually wastes effort to store the length constantly at he fore, but I'm willing to be edumacated on that abstruse point. (Or pointer) Will -Original Message- rom: Wols Lists antli...@youngman.org.uk o: u2-users u2-users@listserver.u2ug.org ent: Fri, Jul 13, 2012 3:53 am ubject: Re: [U2] trimming a list (a test of your ability) n 12/07/12 16:15, Dave Laansma wrote: I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or nother. xcept that a string, as far as I am aware, uses the pascal method I hink it's alled - namely a string is stored as its length followed by he string (or a ollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to a string' faster than -1? ery much so And if so, why doesn't the database use the same logic for -1 as it does for = since technically they're accomplishing the same thing? cause it's doing it in a completely different way. The -1 logic just happens o work whereas the append logic was designed to work hat way. f you use a field number, the code searches for that field - I think it akes he field as a counter, and searches the string decrementing the ounter every ime it hits a field mark. When the counter hits zero it's ound what it's ooking for. f course, if you start at -1, it never hits zero and ends up at the
Re: [U2] trimming a list (a test of your ability)
The Universe editor seems to handle it, but if I write a BASIC program to display the line to my screen, it's truncated So it seems a bit of this and a bit of that. One systems programmer said hey let's fix it here, and didn't tell their colleague in the next cube. -Original Message- From: u2ug simpson-u...@gerzio.ca To: U2 Users List u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 12:20 pm Subject: Re: [U2] trimming a list (a test of your ability) Yep - I've run into that at some time as well. seem to remember this being a problem with the editor or with eading/writing values to an mv file rather than internal string andling. f you re-edit the source, do you find that it has been split into : 001 PRINT DOG 02 :CHAR(255):CAT ? Original Message- rom: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson ent: Friday, July 13, 2012 1:49 PM o: u2-users@listserver.u2ug.org ubject: Re: [U2] trimming a list (a test of your ability) ell I'll be a horned toad. owever try this ED BP TESTFF 01 PRINT DOG:CHAR(255):CAT ^ p arrow mode R/DOG/DOG^255 01 PRINT DOG :CHAR(255):CAT FI BASIC BP TESTFF No closing quote The compiler doesn't see the FF as the same sort of thing as other haracters even if the editor does Original Message- rom: u2ug simpson-u...@gerzio.ca o: U2 Users List u2-users@listserver.u2ug.org ent: Fri, Jul 13, 2012 10:43 am ubject: Re: [U2] trimming a list (a test of your ability) ust to be complete : or j=0 to 255 if char(j)='x' then continue x=abc:char(j):xyz l=len(x) p=index(x,x,1) if j=0 or l#7 or p#5 then crt j=:j crt x =[:x:] crt len=:l crt pos=:p end xt d =0 =[abcxyz] en=7 os=5 -Original Message- om: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] Behalf Of u2ug nt: Friday, July 13, 2012 1:10 PM : U2 Users List bject: Re: [U2] trimming a list (a test of your ability) For universe, believe that used to be true - I seem to recall running into his maybe 5+(?) years ago. also seem to recall that the resolution to this issue was, as was entioned, repending all strings with a length. ry it: x=abc:char(255):xyz crt [:x:] crt len(x) crt index(x,x,1) d abc xyz] Original Message- om: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] Behalf Of Wjhonson nt: Friday, July 13, 2012 12:27 PM : u2-users@listserver.u2ug.org bject: Re: [U2] trimming a list (a test of your ability) es/No string is stored in a fixed length *spot*, and is ended by an FF. is is *why* if you actually try to create a string in BASIC (or read ne) with n embedded FF in it, the runtime will truncate the string It oesn' actually runcate the variable spot, what it does is fool the un-time into thinking ou've hit the end of the string so it ignores nything else after it thinking t's leftover garbage from trimming or omething. o initially let's say you get a spot of 8 bytes which is the default ize of ny variable, if you're string is only 8, it will then allocate ou 50 bytes, nd *move* the string into that new spot and the old spot ill just be a direct ointer to the new spot. f you exceed 50 bytes, it then *allocates* you a new *spot* of 250 ytes lsewhere, and the original 8 byte spot now points at the new spot nd so on. owever, as it scans the string looking for the *end*, if it encounters n FF, hat's the end. e run-time will also garbage-collect the old spots by the way, for use s ther things. 'd be surprised if it actually wastes effort to store the length onstantly at he fore, but I'm willing to be edumacated on that abstruse oint. (Or pointer) Will -Original Message- om: Wols Lists antli...@youngman.org.uk : u2-users u2-users@listserver.u2ug.org nt: Fri, Jul 13, 2012 3:53 am bject: Re: [U2] trimming a list (a test of your ability) n 12/07/12 16:15, Dave Laansma wrote: 'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' bout pointers, it still has to get to the end of the 'string' one way r nother. cept that a string, as far as I am aware, uses the pascal method I ink it's alled - namely a string is stored as its length followed by he tring (or a ollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to string' faster than -1? ry much so And if so, why doesn't the database use the same logic for -1 as it oes for = since technically they're accomplishing the same thing? cause it's doing it in a completely different way. The -1 logic just appens o work whereas the append logic was designed to work hat way. you use a field number, the code searches for that field - I think it kes he field as a counter, and searches the string decrementing the unter every ime it hits a field mark. When the counter hits zero it's und what it's ooking for. course, if you start at -1, it never hits zero and ends up at the end the tring. But this is by
Re: [U2] trimming a list (a test of your ability)
I think you know that various bits of the entire system have been tweaked to *allow* an FF, and other various bits have not. So if you do a size-based Read on a Windows file in Universe, and it has an embedded FF, it will probably truncate But perhaps you can read it using a line-based Read That sort of thing. Some of this may be by design, some by default, some kinda lookin like a bug. -Original Message- From: u2ug simpson-u...@gerzio.ca To: U2 Users List u2-users@listserver.u2ug.org Sent: Fri, Jul 13, 2012 12:23 pm Subject: Re: [U2] trimming a list (a test of your ability) Oops - meant to say : I seem to remember this being a problem writing values to an mv file ather than internal string handling. Original Message- rom: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of u2ug ent: Friday, July 13, 2012 2:54 PM o: U2 Users List ubject: Re: [U2] trimming a list (a test of your ability) Yep - I've run into that at some time as well. seem to remember this being a problem with the editor or with eading/writing values to an mv file rather than internal string andling. f you re-edit the source, do you find that it has been split into : 001 PRINT DOG 02 :CHAR(255):CAT ? Original Message- rom: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson ent: Friday, July 13, 2012 1:49 PM o: u2-users@listserver.u2ug.org ubject: Re: [U2] trimming a list (a test of your ability) ell I'll be a horned toad. owever try this ED BP TESTFF 01 PRINT DOG:CHAR(255):CAT ^ p arrow mode R/DOG/DOG^255 01 PRINT DOG :CHAR(255):CAT FI BASIC BP TESTFF No closing quote The compiler doesn't see the FF as the same sort of thing as other haracters even if the editor does Original Message- rom: u2ug simpson-u...@gerzio.ca o: U2 Users List u2-users@listserver.u2ug.org ent: Fri, Jul 13, 2012 10:43 am ubject: Re: [U2] trimming a list (a test of your ability) ust to be complete : or j=0 to 255 if char(j)='x' then continue x=abc:char(j):xyz l=len(x) p=index(x,x,1) if j=0 or l#7 or p#5 then crt j=:j crt x =[:x:] crt len=:l crt pos=:p end xt d =0 =[abcxyz] en=7 os=5 -Original Message- om: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] Behalf Of u2ug nt: Friday, July 13, 2012 1:10 PM : U2 Users List bject: Re: [U2] trimming a list (a test of your ability) For universe, believe that used to be true - I seem to recall running into his maybe 5+(?) years ago. also seem to recall that the resolution to this issue was, as was entioned, repending all strings with a length. ry it: x=abc:char(255):xyz crt [:x:] crt len(x) crt index(x,x,1) d abc xyz] Original Message- om: u2-users-boun...@listserver.u2ug.org mailto:u2-users-boun...@listserver.u2ug.org] Behalf Of Wjhonson nt: Friday, July 13, 2012 12:27 PM : u2-users@listserver.u2ug.org bject: Re: [U2] trimming a list (a test of your ability) es/No string is stored in a fixed length *spot*, and is ended by an FF. is is *why* if you actually try to create a string in BASIC (or read ne) with n embedded FF in it, the runtime will truncate the string It oesn' actually runcate the variable spot, what it does is fool the un-time into thinking ou've hit the end of the string so it ignores nything else after it thinking t's leftover garbage from trimming or omething. o initially let's say you get a spot of 8 bytes which is the default ize of ny variable, if you're string is only 8, it will then allocate ou 50 bytes, nd *move* the string into that new spot and the old spot ill just be a direct ointer to the new spot. f you exceed 50 bytes, it then *allocates* you a new *spot* of 250 ytes lsewhere, and the original 8 byte spot now points at the new spot nd so on. owever, as it scans the string looking for the *end*, if it encounters n FF, hat's the end. e run-time will also garbage-collect the old spots by the way, for use s ther things. 'd be surprised if it actually wastes effort to store the length onstantly at he fore, but I'm willing to be edumacated on that abstruse oint. (Or pointer) Will -Original Message- om: Wols Lists antli...@youngman.org.uk : u2-users u2-users@listserver.u2ug.org nt: Fri, Jul 13, 2012 3:53 am bject: Re: [U2] trimming a list (a test of your ability) n 12/07/12 16:15, Dave Laansma wrote: 'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' bout pointers, it still has to get to the end of the 'string' one way r nother. cept that a string, as far as I am aware, uses the pascal method I ink it's alled - namely a string is stored as its length followed by he tring (or a ollerith string as I used to do in FORTRAN). So, the question then is, does concatenation := establish and append to string' faster than -1? ry much so And if so, why doesn't the database use the same logic for -1 as it oes for = since technically they're
Re: [U2] trimming a list (a test of your ability)
The general reason why I post code snippets like this, isn't really necessarily always to solve the issue I'm having, but often to see examples of how others solve similar issues. It's my belief that by sharing how we do things, we can all learn something new and interesting. We may use that, or may not, but sometimes somehow on the other side of the world, has solved a problem in a very clever way. And you may use that. So sharing publicly, enhances us all. By the way, something Marco said was new to me. Does clearing a variable to free the memory really do something significant on today's machines? Or is that an anachronism? I don't know the answer, anyone comment on that? Will ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO ;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,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
Re: [U2] trimming a list (a test of your ability)
That was my first thought, Change to KEY.COUNT TO 1 STEP -1 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach Sent: Thursday, July 12, 2012 4:22 AM To: 'U2 Users List' Subject: Re: [U2] trimming a list (a test of your ability) Well, If you're deleting from a list you want to be iterating backwards. If you're on UniVerse you want to be using field not value level (for hint mechanism) or use revremove. It assumes LAST.NAME is not empty. Since I don't know your data I do know if using index will stuff it if is not a unique part of a field, or if it more efficient to build a new key list or take from the current (are there more deleted than kept?) You can use the new (ugly, ugly but potentially useful) U2 Dynamic Objects to make a dictionary structure to ensure uniqueness.. Brian -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: 12 July 2012 01:10 To: u2-users@listserver.u2ug.org Subject: [U2] trimming a list (a test of your ability) 1295 FOR DISPLAY.LOOP = 1 TO KEY.COUNT 1296 UTILITY.ID = KEY.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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 ___ 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
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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO ;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,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
Re: [U2] trimming a list (a test of your ability)
String concatenation will probably work faster since it doesn't care about pointers IF NEW.LIST# THEN NEW.LIST := @AM (or @VM if you want in the original format) NEW.LIST := UTILITY.ID Martin -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma Sent: 12 July 2012 14:20 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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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 Click https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg== to report this email as spam. Epicor Software (UK) is a limited company registered in England Wales. Registration Number: 2338274. Registered Office: 6th Floor, One London Wall, London EC2Y 5EB This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. Any views and/or opinions expressed in this e-mail are of the author only and do not represent the views of Epicor Software (UK) Limited or any other company within its group. This message has been scanned for malware by Websense. www.websense.com
Re: [U2] trimming a list (a test of your ability)
Use 'STEP -1' so as to work from the back to front. That would avoid the need to reset DISPLAY.LOOP and KEY.COUNT 1295 FOR DISPLAY.LOOP = KEY.COUNT TO 1 STEP -1 1296 UTILITY.ID = KEY.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1302 END 1303 NEXT DISPLAY.LOOP Marc Rutherford Principal Programmer Analyst Advanced Bionics LLC 661) 362 1754 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Wednesday, July 11, 2012 5:10 PM To: u2-users@listserver.u2ug.org Subject: [U2] trimming a list (a test of your ability) 1295 FOR DISPLAY.LOOP = 1 TO KEY.COUNT 1296 UTILITY.ID = KEY.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] trimming a list (a test of your ability)
Is this technique significantly faster? It still has to search to the end of the table each time it appends this string, doesn't it? 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 George Gallen Sent: Thursday, July 12, 2012 9: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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO ;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,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
Re: [U2] trimming a list (a test of your ability)
I'm puzzled by '... doesn't care ...' terminology. Of course it 'cares' about pointers, it still has to get to the end of the 'string' one way or another. So, the question then is, does concatenation := establish and append to a 'string' faster than -1? And if so, why doesn't the database use the same logic for -1 as it does for := since technically they're accomplishing the same thing? 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 Martin Braid Sent: Thursday, July 12, 2012 9:41 AM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) String concatenation will probably work faster since it doesn't care about pointers IF NEW.LIST# THEN NEW.LIST := @AM (or @VM if you want in the original format) NEW.LIST := UTILITY.ID Martin -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma Sent: 12 July 2012 14:20 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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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 Click https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg== to report this email as spam. Epicor Software (UK) is a limited company registered in England Wales. Registration Number: 2338274. Registered Office: 6th Floor, One London Wall, London EC2Y 5EB This e-mail is
Re: [U2] trimming a list (a test of your ability)
I just did a test of this on Universe 10 on Windows 7 and it doesn't make any difference FFT.BP 'SPEED.TEST' 0001 GOSUB SUB.ONE 0002 GOSUB SUB.TWO 0003 * 0004 GOSUB SUB.TWO 0005 GOSUB SUB.ONE 0006 STOP 0007 * 0008 SUB.ONE: 0009 START = TIME() 0010 A = '' 0011 FOR I = 1 TO 50 0012 A-1 = I 0013 NEXT I 0014 FINISH = TIME() 0015 ELAPSE = FINISH - START 0016 DISPLAY ELAPSE:' SECONDS' 0017 RETURN 0018 * 0019 SUB.TWO: 0020 START = TIME() 0021 A = '' 0022 FOR I = 1 TO 50 0023 A := @AM:I 0024 NEXT I 0025 FINISH = TIME() 0026 ELAPSE = FINISH - START 0027 DISPLAY ELAPSE:' SECONDS' 0028 RETURN 0029 * 0030END Results 2.657 SECONDS 2.734 SECONDS 2.703 SECONDS 2.563 SECONDS I did each routine twice as you can see, flipping the order to eliminate any possibility of caching having an effect. -Original Message- From: Dave Laansma dlaan...@hubbardsupply.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Thu, Jul 12, 2012 7:59 am Subject: Re: [U2] trimming a list (a test of your ability) Is this technique significantly faster? It still has to search to the end of the able each time it appends this string, doesn't it? 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] n Behalf Of George Gallen ent: Thursday, July 12, 2012 9: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] n 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] n 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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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
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 = 1 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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO ;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,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
Re: [U2] trimming a list (a test of your ability)
HOLY SMOKES! X = X : string Is CRAZY slow! I had to break out. My results on Unidata/AIX, -1 was SLIGHTLY faster than := for 1,000,000 appendages to a null table. 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 David A. Green Sent: Thursday, July 12, 2012 12:25 PM 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 = 1 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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO ;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,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,
Re: [U2] trimming a list (a test of your ability)
Absolutely correct, but it didn't make a difference when I reverse the order of the tests. I got to 0 vs 565 when I shut it down (and 500+ vs 0 in reverse order). I think that is a clear enough answer. Caveat, this was done on UDT, other MVDMS may behave different. As always; don't assume, test. -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 9:59 AM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) *** slightly *** unfair test... 1st loop has more memory available. Set X to before setting 2nd START.TIME... or run a 2nd program . . 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 10:56 AM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) ROUNDS = 1 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.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO ;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,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
Re: [U2] trimming a list (a test of your ability)
Sort of OT: My NebulaXLite product builds XML files that can get into tens of megabytes. Concatenation with either method described below can cause this process to take 1/2 hour or longer. I developed a technique that reduces build time of these large blocks down to seconds, and no, this isn't a method that has been discussed in public before. I know this would be valuable information to many companies that seek to reduce processing time of large blocks of data (CSV, EDI, HTML, XML, JSON, SQL, etc). I just can't think of a way to recover my research and development costs for this or anything else if the information is published in a forum for everyone to consume for free, or if the information is shared with a colleague who then provides a service to others to speed up applications without my assistance. Someone needs to pay for RD like this or people simply can't continue to innovate - just ask your pharmaceutical company. So anyway, while I feel like a tease for saying so, if you find your X-1 code still takes a Long time to process after you get to thousands of attributes or megabytes of data, just know that it Can be significantly improved, I just can't tell you how right now. awkward ... T From: Daniel McGrath ROUNDS = 1 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. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
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 100 ;* 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 = 1 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
Re: [U2] trimming a list (a test of your ability)
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 100 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 100 ;* 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 = 1 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
Re: [U2] trimming a list (a test of your ability)
I can think of a way I've used in the past. You keep track of the size, or use a break every so-many values like 100 or whatever or a size of 10K or whatever And then you simply start in a new empty carrier variable So you have an embedded loop FOR I = 1 TO 500 A-1 = I IF NOT(MOD(I,1000)) THEN B-1 = A; A = '' NEXT I IF MOD(I,1000) THEN B-1 = A This will only shift things to B every time A gets to a size of 1000 attributes. The shift will take a second but then the continued concat to A will be very fast again. -Original Message- From: Tony Gravagno 3xk547...@sneakemail.com To: u2-users u2-users@listserver.u2ug.org Sent: Thu, Jul 12, 2012 1:20 pm Subject: Re: [U2] trimming a list (a test of your ability) Sort of OT: y NebulaXLite product builds XML files that can get into tens of egabytes. Concatenation with either method described below can cause his process to take 1/2 hour or longer. I developed a technique that educes build time of these large blocks down to seconds, and no, this sn't a method that has been discussed in public before. I know this ould be valuable information to many companies that seek to reduce rocessing time of large blocks of data (CSV, EDI, HTML, XML, JSON, QL, etc). I just can't think of a way to recover my research and evelopment costs for this or anything else if the information is ublished in a forum for everyone to consume for free, or if the nformation is shared with a colleague who then provides a service to thers to speed up applications without my assistance. Someone needs o pay for RD like this or people simply can't continue to innovate - ust ask your pharmaceutical company. So anyway, while I feel like a ease for saying so, if you find your X-1 code still takes a Long ime to process after you get to thousands of attributes or megabytes f data, just know that it Can be significantly improved, I just can't ell you how right now. awkward ... From: Daniel McGrath ROUNDS = 1 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. __ 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
Re: [U2] trimming a list (a test of your ability)
Could you show us a comparison of times using your methods? -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tony Gravagno Sent: Thursday, July 12, 2012 12:52 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] trimming a list (a test of your ability) Sort of OT: My NebulaXLite product builds XML files that can get into tens of megabytes. Concatenation with either method described below can cause this process to take 1/2 hour or longer. I developed a technique that reduces build time of these large blocks down to seconds, and no, this isn't a method that has been discussed in public before. I know this would be valuable information to many companies that seek to reduce processing time of large blocks of data (CSV, EDI, HTML, XML, JSON, SQL, etc). I just can't think of a way to recover my research and development costs for this or anything else if the information is published in a forum for everyone to consume for free, or if the information is shared with a colleague who then provides a service to others to speed up applications without my assistance. Someone needs to pay for RD like this or people simply can't continue to innovate - just ask your pharmaceutical company. So anyway, while I feel like a tease for saying so, if you find your X-1 code still takes a Long time to process after you get to thousands of attributes or megabytes of data, just know that it Can be significantly improved, I just can't tell you how right now. awkward ... T From: Daniel McGrath ROUNDS = 1 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. ___ 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
Re: [U2] trimming a list (a test of your ability)
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 100 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 100 ;* 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
Re: [U2] trimming a list (a test of your ability)
From: Lunt, Bruce Could you show us a comparison of times using your methods? It'll take a while to do that, sorry. I'm just testing this functionality in the latest version which will be available for U2 in a month or so. But I will be publishing before/after performance data as part of the encouragement for existing NebulaXLite users to upgrade. As noted below, so far the results are dramatic, from over 30 minutes down to close to 30 seconds, all due to the overhead of building large items. Half of the time I spent on this after initial testing was trying to figure out why the numbers were wrong - and they weren't. I was just informed that the technique I'm using may have been published somewhere but I don't know if that was something I published without detail or if this knowledge is more widespread than I thought. Please forgive a bit of overzealous posturing if that's the case. For my next trick, I'll invent fire. Oh it has? Never mind. How about water? Really? Dangit! Fusion? There's even Fusionware? Is nothing left uninvented or reinvented in this industry? :) T From: Tony Gravagno Sort of OT: My NebulaXLite product builds XML files that can get into tens of megabytes. Concatenation with either method described below can cause this process to take 1/2 hour or longer. I developed a technique that reduces build time of these large blocks down to seconds, and no, this isn't a method that has been discussed in public before. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] trimming a list (a test of your ability)
JUST FOR FUN... I bumped the iteration count to 10,000,000 And the DIM BIG() to 10,000 Ran in 60 seconds with 157,094 to 355,618 iterations per second. Total byte count of the resulting @MV list was 78,888,896 bytes NOT too shabby ... 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 David L. Wasylenko Sent: Thursday, July 12, 2012 4:57 PM To: U2 Users List Subject: Re: [U2] trimming a list (a test of your ability) Not exactly. Current position of EACH unique variable... And a DIM BIG(1000) has/is 1,000 unique variables. So 1,000 unique pointers. And the writing whole string --- yes it would, if the size outstrips the memory allocated. By using 1,000 smaller strings, the move is triggered much less often, allowing the append operation VS reallocation of a new, larger memory buffer. With REC-1 or REC1,-1 syntax: Using a *single* variable, 1,000,000 iterations: @am delimited = 21.719 seconds, ranging from 41,545 iterations a second to 45,161, very consistant @vm delimited = ( Had to stop it at 100,000 iterations, 235.561 seconds) from 12,787 iterations a second at start down to 449 per sec at 100,000 values, consistently slower and slower Just using REC-1 saved a HUGE amount of time. Using a DIM(1000) variable: @vm delimited = 24.859 seconds 39,553 to 317,460 per second; wide swing but much faster than a single variable @am delimited = 3.781 seconds245,158 to 425,531 per second; the big winner The @VM delimiter will continually get slower and slower using either method, however, the slowdown occurs only 1,000 times. So in either case, the savings is significant using @AM - the DIM() concept is icing and the best method I've seen. ... 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 Wjhonson Sent: Thursday, July 12, 2012 4:16 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] trimming a list (a test of your ability) 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 100 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
Re: [U2] trimming a list (a test of your ability)
Thought I'd have a go at something a bit different so I came up with a recursive routine (CHECK.LIST). I used a simple list of 5000 integers and filtered evens out as my test. The recursion basically splits the list in half until it's smallish, then processes CNT to 1 step -1. It didn't produce dramatic time savings until I used dimensioned arrays to quickly split the source list. I used the best suggestions from all the previous posts to compare a few different methods to gauge how each performs. TEST.LIST.PROCESSING List has 5000 entries 1]2]3]4]5]6]7]8]9]10]11]12]13]14]15]16]17]18]19]20]21]22]23]24]25]26]27] 28]... Evens filtered with DELETE, elapsed time is 313ms 1]3]5]7]9]11]13]15]17]19]21]23]25]27]29]31]33]35]37]39]41]43]45]47]49]51 ]53]55] Filtered with DEL, elapsed time is 453ms 1]3]5]7]9]11]13]15]17]19]21]23]25]27]29]31]33]35]37]39]41]43]45]47]49]51 ]53]55] DELETE using CNT to 1 STEP -1, elapsed time is 578ms 1]3]5]7]9]11]13]15]17]19]21]23]25]27]29]31]33]35]37]39]41]43]45]47]49]51 ]53]55] Filtered using second list, elapsed time is 547ms 1]3]5]7]9]11]13]15]17]19]21]23]25]27]29]31]33]35]37]39]41]43]45]47]49]51 ]53]55] Split lists recursively filter small lists, elapsed time is 16ms 1]3]5]7]9]11]13]15]17]19]21]23]25]27]29]31]33]35]37]39]41]43]45]47]49]51 ]53]55] Regards, Eric Y. Neu Sr. Programmer Analyst Zetron, Inc. 425.820.6363 x271 www.zetron.com ps are attachements allowed on this list server, wasn't sure so I posted the routines inline * Program: TEST.LIST.PROCESSING* * Purpose: test list handling methods * * By: EYNeu - 07/12/12 * * build a list of integers time filtering evens * from the list using various methods and techniques * --- build a list of integers to process TOTCNT = 5000 LIST = '' FOR I = 1 TO TOTCNT LIST-1=I NEXT I SAVELIST = LIST PRINT 'List has ':TOTCNT:' entries' PRINT LIST[1,75]:'...' * --- DELETE is baseline method CNT = TOTCNT LIST = SAVELIST BT = SYSTEM(12) FOR I = 1 TO CNT IF LISTI/2 = INT(LISTI/2) THEN LIST = DELETE(LIST,I) I -= 1 CNT -= 1 END NEXT I ET = SYSTEM(12) PRINT PRINT 'Evens filtered with DELETE,': PRINT ' elapsed time is ':ET-BT:'ms' PRINT LIST[1,79] * --- try DEL instead CNT = TOTCNT LIST = SAVELIST BT = SYSTEM(12) FOR I = 1 TO CNT IF LISTI/2 = INT(LISTI/2) THEN DEL LISTI I -= 1 CNT -= 1 END NEXT I ET = SYSTEM(12) PRINT PRINT 'Filtered with DEL,': PRINT ' elapsed time is ':ET-BT:'ms' PRINT LIST[1,79] * -- baseline method working from cnt to 1 CNT = TOTCNT LIST = SAVELIST BT = SYSTEM(12) FOR I = CNT TO 1 STEP -1 IF LISTI/2 = INT(LISTI/2) THEN LIST = DELETE(LIST,I) END NEXT I ET = SYSTEM(12) PRINT PRINT 'DELETE using CNT to 1 STEP -1,': PRINT ' elapsed time is ':ET-BT:'ms' PRINT LIST[1,79] * --- filter using a second list CNT = TOTCNT LIST = SAVELIST LIST2 = '' BT= SYSTEM(12) FOR I = 1 TO CNT IF LISTI/2 # INT(LISTI/2) THEN LIST2-1 = LISTI END NEXT I ET= SYSTEM(12) LIST = LIST2 LIST2 = '' PRINT PRINT 'Filtered using second list,': PRINT ' elapsed time is ':ET-BT:'ms' PRINT LIST[1,79] * --- recursively split list and filter smaller lists LIST = SAVELIST BT = SYSTEM(12) CALL CHECK.LIST(LIST) ET = SYSTEM(12) PRINT PRINT 'Split lists recursively filter small lists,': PRINT ' elapsed time is ':ET-BT:'ms' PRINT LIST[1,79] SUBROUTINE CHECK.LIST(LIST) * Program: CHECK.LIST * * Purpose: Recursive list processor* * By: EYNeu - 07/12/12 * LISTMAX = 100 CNT = DCOUNT(LIST,@AM) IF CNT LISTMAX THEN MID = INT(CNT/2) * -- first go at splitting lists * -- too much overhead in building split lists this way *FIRSTHALF = '' *FOR I = 1 TO MID * FIRSTHALF-1 = LISTI *NEXT I *CALL CHECK.LIST(FIRSTHALF) * *SECONDHALF = '' *FOR I = MID+1 TO CNT * SECONDHALF-1 = LISTI *NEXT I *CALL CHECK.LIST(SECONDHALF) * -- second go at splitting a list * -- dimensioned arrays are handy for a quick split FIRSTHALF = '' SECONDHALF = '' DIM LISTARRAY(CNT) MATPARSE LISTARRAY FROM LIST,@AM MATBUILD FIRSTHALF FROM LISTARRAY,1,MID CALL CHECK.LIST(FIRSTHALF) MATBUILD SECONDHALF FROM LISTARRAY,MID+1,CNT CALL CHECK.LIST(SECONDHALF) * -- put the lists back together LIST = FIRSTHALF LIST-1 = SECONDHALF END ELSE * -- perform the filter here FOR I = CNT TO 1 STEP -1 IF LISTI/2 = INT(LISTI/2) THEN LIST = DELETE(LIST,I) END NEXT I END RETURN -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Wednesday, July 11, 2012 5:10 PM To: u2-users@listserver.u2ug.org Subject: [U2] trimming a list (a test of your ability) 1295 FOR DISPLAY.LOOP = 1 TO KEY.COUNT
Re: [U2] trimming a list (a test of your ability)
The runtime does not maintain a pointer to each cell in a dimensioned array. The cell positions are *calculated* using an initial offset address and then a formula. No pointers. Or *one* if you prefer to call the offset address a pointer to the start of the array. The moving pointer into a dynamic array however is a true full-address pointer. A dimensioned array has 1000 cells, fixed in position, and no pointers. A dynamic array has a string pre-set at a certain size (which can grow by dynamic linking) and a single pointer to your current position. The issue with picking up and laying down the string is not related to the dynamic linking. If you address yourself into the middle of the string, the system has no choice but to pick up and rewrite the entire string, in order to shift the end. The reason why it's probably faster to address the end, is that possibly this has been optimized to simply write at the end, and not bother with the rest of it. Not sure, I may be wrong on that point. The reason why the VM version is slow, is simply because the system was never optimized to carry a pointer when using a VM array. That's all. So it has to rescan the whole string every time you change it, including appending. By the way, why are you bringin in dimensioned in the first place? I don't anyone was talking about that. -Original Message- From: David L. Wasylenko d...@pickpro.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Thu, Jul 12, 2012 4:26 pm Subject: Re: [U2] trimming a list (a test of your ability) Not exactly. urrent position of EACH unique variable... nd a DIM BIG(1000) has/is 1,000 unique variables. So 1,000 unique pointers. nd the writing whole string --- yes it would, if the size outstrips the emory allocated. y using 1,000 smaller strings, the move is triggered much less often, allowing he append operation VS reallocation of a new, larger memory buffer. With REC-1 or REC1,-1 syntax: Using a *single* variable, 1,000,000 iterations: am delimited = 21.719 seconds, ranging from 41,545 iterations a second to 5,161, very consistant vm delimited = ( Had to stop it at 100,000 iterations, 235.561 seconds) from 12,787 iterations a second at start down to 449 per sec at 100,000 alues, consistently slower and slower Just using REC-1 saved a HUGE amount of time. Using a DIM(1000) variable: vm delimited = 24.859 seconds 39,553 to 317,460 per second; wide swing but uch faster than a single variable am delimited = 3.781 seconds245,158 to 425,531 per second; the big winner he @VM delimiter will continually get slower and slower using either method, owever, the slowdown occurs only 1,000 times. o in either case, the savings is significant using @AM - the DIM() concept is cing and the best method I've seen. ... 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 Wjhonson ent: Thursday, July 12, 2012 4:16 PM o: u2-users@listserver.u2ug.org ubject: Re: [U2] trimming a list (a test of your ability) beg to differ. he runtime maintains a pointer to *your current attribute*, as I understand it. Not to *each* attribute location. ne buffer location, not a thousand. If it maintained a pointer to *each* attribute location, you could jump around n the variable at random and has access as quick as a dimensioned array gives ou. But I believe that is not the case. By-attribute insertion is quick *only* because you are always inserting at the urrent position (or the next). hange this to a locate with insertion and it should dramatically slow down. his is because the entire string is being picked up and put down on each nsert. The whole string. think in the case of insertion at the end (the current position) it doesn't ctually pick up and rewrite the whole string on each append. ust the end of the string. Original Message- rom: David L. Wasylenko d...@pickpro.com o: U2 Users List u2-users@listserver.u2ug.org ent: Thu, Jul 12, 2012 2:09 pm ubject: Re: [U2] trimming a list (a test of your ability) ope; s to do with how systems handle system delimiters. namic arrays maintain pointers to attribute locations, but not the @VM ointers. e system already has buffering, memory management etc. for string anipulation. owever, what makes it fast is the routine makes use of 1,000 different memory cations, ach being vastly smaller than the final resulting record. ach element of the array is smaller string, resulting in less paging, heap nipulation etc. he following example uses ONE variable instead of the previous 1000; xecution ime is 21.735 seconds compared to the prior version: 3.75 seconds 1:D.ARRAY= ; START.TIME=TIME() :FOR PTR=1 TO 100 : GOSUB H.ADD; * add to array : ! IF NOT(MOD(PTR,1000)) THEN CRT PTR :NEXT PTR :GOSUB
Re: [U2] trimming a list (a test of your ability)
To continue along these lines, and if you want your code to be compact, if KEY.LIST were equal to RAISE(KEY.LIST) you could do this: NEW.LIST = SELECT KEY.LIST LOOP WHILE READNEXT UTILITY.ID DO GOSUB GET.UTILITY.RECORD IF INDEX(UTILITY.NAME,LAST.NAME,1) THEN NEW.LIST-1 = UTILITY.ID REPEAT UV 10.2 Regards, Marc On Thu, 12 Jul 2012 09:22:11 +0100, Brian Leach wrote: Well, If you're deleting from a list you want to be iterating backwards. If you're on UniVerse you want to be using field not value level (for hint mechanism) or use revremove. It assumes LAST.NAME is not empty. Since I don't know your data I do know if using index will stuff it if is not a unique part of a field, or if it more efficient to build a new key list or take from the current (are there more deleted than kept?) You can use the new (ugly, ugly but potentially useful) U2 Dynamic Objects to make a dictionary structure to ensure uniqueness.. Brian -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: 12 July 2012 01:10 To: u2-users@listserver.u2ug.org Subject: [U2] trimming a list (a test of your ability) 1295 FOR DISPLAY.LOOP = 1 TO KEY.COUNT 1296 UTILITY.ID = KEY.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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 ___ 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
Re: [U2] trimming a list (a test of your ability)
Hi Steven The REMOVE statement process a multivalued list. The SETTING clause will set the variable to either 3, or 2, or 1, or 0 depending on the value of the delimiter last encountered... 1 for @FM 2 for @VM 3 for @SM 0 for End Of String If the array consists only of @FM, then MORE will be set to 1 for each iteration (since the delimiter it is encountering each time is an @FM) and then, when the last element is read, MORE will be set to ZERO, and the WHILE MORE will fail, thus the loop is exited. If FM.ARRAY is empty, MORE will return as 0 and the loop will exit, but you're right - the WHILE MORE line should be one line higher.. UNIQ.LIST = '' LOOP REMOVE NEXT.ID http://next.id/ FROM FM.ARRAY SETTING MORE WHILE MORE LOCATE(NEXT.ID http://next.id/,UNIQ.LIST,1;POS) ELSE UNIQ.LIST-1 = NEXT.ID http://next.id/ REPEAT the WHILE statement is in effect a while it is not zero and the second it becomes a zero, the loop exits. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
[U2] trimming a list (a test of your ability)
1295 FOR DISPLAY.LOOP = 1 TO KEY.COUNT 1296 UTILITY.ID = KEY.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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
Re: [U2] trimming a list (a test of your ability)
I am getting sucked in! NLST =;* For new list MAXI = DCOUNT(KEY.LIST1,@vM) ;* Count items FOR INO =1 TO MAXI ;* Each key in list KEY.ID = KEY.LIST1,INO;* A key ID LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE ;* see if there INS KEY.ID BEFORE NLIST1,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.LIST1,DISPLAY.LOOP 1297 GOSUB GET.UTILITY.RECORD 1298 IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN 1299KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0) 1300DISPLAY.LOOP -= 1 1301KEY.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