Yes, exactly. If you starting breaking down what would be happening behind the 
scenes, you can see why X<-1>=I will be faster than X:= @AM:I will be faster 
than := X:@AM:I

Hint, it is all about memory management, temporary variables, individual byte 
code ops and big O complexity (not necessarily in that order).

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David A. Green
Sent: Thursday, July 12, 2012 10:25 AM
To: 'U2 Users List'
Subject: Re: [U2] trimming a list (a test of your ability)

Ah, but try it with := instead of Y = Y:

David A. Green
(480) 813-1725
DAG Consulting

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Daniel McGrath
Sent: Thursday, July 12, 2012 8:56 AM
To: U2 Users List
Subject: Re: [U2] trimming a list (a test of your ability)

ROUNDS = 10000
LOOP
   X = '' ; Y = ''
   START.TIME = TIME()
   FOR I = 1 TO ROUNDS
      X<-1> = I
   NEXT I
   END.TIME = TIME()
   CRT END.TIME-START.TIME : " vs " :
   START.TIME = TIME()
   FOR I = 1 TO ROUNDS
      Y = Y:CHAR(254):I
   NEXT I
   END.TIME = TIME()
   CRT END.TIME-START.TIME
   ROUNDS *= 2
REPEAT

----

Results suggest that you should od <-1>, not the multiple concatenation.

Dan McGrath
Product Manager
Rocket Software
4600 S. Ulster Street ..Suite 1100 ..Denver, CO 80237 . USA
t: +1.720.475.8098 . m: +1.617.630.7392 . e:dmcgr...@rocketsoftware.com w:
rocketsoftware.com/u2





-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen
Sent: Thursday, July 12, 2012 7:30 AM
To: U2 Users List
Subject: Re: [U2] trimming a list (a test of your ability)

Instead of <-1>, use  string=string:char(254):additionalelement

George

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma
Sent: Thursday, July 12, 2012 9:20 AM
To: Marco Manyevere; U2 Users List
Subject: Re: [U2] trimming a list (a test of your ability)

This is the best solution, using REMOVE and building a new list instead of 
constantly 'shrinking' the original table.

That being said, as NEW.LIST gets rather large, adding new elements to it can 
get 'time' consuming. Just like the REMOVE keeps track of the pointer as you 
spin through a table, I wish there was a comparable statement that kept track 
of the pointer as we added new elements <-1> to tables.

Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234-8681
Fax: 810-234-6142
www.hubbardsupply.com
"Delivering Products, Services and Innovative Solutions"

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Marco Manyevere
Sent: Thursday, July 12, 2012 4:14 AM
To: U2 Users List
Subject: Re: [U2] trimming a list (a test of your ability)

Is this what the OP is asking about or I'm missing something? The 2 code 
fragments look totally different. We dont know what's happening in 
GET.UTILITY.RECORD or the significance of UTILITY.NAME and LAST.NAME to totally 
eliminate them during the 'optimisation'

I would rather do:
 
NEW.LIST = ''
LOOP
  REMOVE UTILITY.ID FROM KEY.LIST SETTING MORE WHILE MORE:UTILITY.ID
  GOSUB GET.UTILITY.RECORD
   IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN CONTINUE
   NEW.LIST<-1> = UTILITY.ID
REPEAT
KEY.LIST = NEW.LIST
NEW.LIST = '' ;* free the memory
 

________________________________
 From: Kate Stanton <k...@walstan.com>
To: U2 Users List <u2-users@listserver.u2ug.org>
Sent: Thursday, 12 July 2012, 4:27
Subject: Re: [U2] trimming a list (a test of your ability)
  
I am getting sucked in!

NLST = ""                                                       ;* For new list 
MAXI = DCOUNT(KEY.LIST<1>,@vM)         ;* Count items FOR INO =1 TO MAXI        
                           ;* Each key in list
  KEY.ID = KEY.LIST<1,INO>                        ;* A key ID
  LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE  ;* see if there
    INS KEY.ID BEFORE NLIST<1,POS>       ;* Sort to list
  END
NEXT INO                                                      ;* Check all keys 
On 12 July 2012 12:09, Wjhonson <wjhon...@aol.com> wrote:

>
> 1295          FOR DISPLAY.LOOP = 1 TO KEY.COUNT
> 1296             UTILITY.ID = KEY.LIST<1,DISPLAY.LOOP>
> 1297             GOSUB GET.UTILITY.RECORD
> 1298             IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN
> 1299                KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0)
> 1300                DISPLAY.LOOP -= 1
> 1301                KEY.COUNT -= 1
> 1302             END
> 1303          NEXT DISPLAY.LOOP
>
>
> Comments?
>
>
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>



--
Kate Stanton
Walstan Systems Ltd
4 Kelmarna Ave, Herne Bay, Auckland 1011, New Zealand
Phone: + 64 9 360 5310  Mobile: + 64 21 400 486
Email: k...@walstan.com
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

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

Reply via email to