WthmO,

Text conversions of lists are notoriously slow!

To prove this, I just tested our two approaches wrapped in a repeat 
loop (100x), so I could get significant measurements.

I used two built-in proplists, the XtraList & the movieXtraList
(after fattening up the movieXtraList by adding 'all the Xtras < the 
letter n' to it).

Your text conversion approach is about 2 orders of magnitude slower ...

Here's the data & the handlers:

concatListsBK the XtraList,  the movieXtraList
-- "72 miliseconds = (100x)"
-- "counts = " 77 31 108

ConcatListsHowdy the XtraList,  the movieXtraList
-- "5475 miliseconds = (100x)"
-- "counts = " 77 31 108

on concatListsBK listA, listB

   t = the milliseconds 
   repeat with j = 1 to 100
     cA = listA.count
     cB = listB.count
    
     if cA < cB then
       listC = listB.duplicate()
       repeat with i = cA down to 1
         listC.addAt(1, listA[i])
       end repeat
     else
       listC = listA.duplicate()
       repeat with i = cB down to 1
         listC.addAt(1, listB[i])
       end repeat
     end if
   end repeat
   put (the milliseconds - t) && "miliseconds" & " = (100x)"

   put "counts = ", listA.count, listB.count, listC.count
end

on ConcatListsHowdy list1, list2

   t = the milliseconds 
   repeat with j = 1 to 100
    
     sList1 = string ( list1 )
     delete the last char of sList1
    
     sList2 = string (list2 )
     delete char 1 of sList2
    
     m = ( value ( sList1 & "," && sList2 ) )
   end repeat
   put (the milliseconds - t) && "miliseconds" & " = (100x)"

   put "counts = ", list1.count, list2.count, m.count
END ConcatListsHowdy

sorry dude.

hth

-Buzz

At 10:44 AM -0500 4/11/02, you wrote:
>At 14:48 -0700 04/10/2002, Buzz Kettles wrote:
>
>>note: string converting of lists is really slow.
>
>Yes, but with a long list, I would expect it to still be faster than a repeat.
>
>--
>-- WthmO
>[To remove yourself from this list, or to change to digest mode, go 
>to http://www.penworks.com/lingo-l.cgi  To post messages to the 
>list, email [EMAIL PROTECTED]  (Problems, email 
>[EMAIL PROTECTED]). Lingo-L is for learning and helping with 
>programming Lingo.  Thanks!]

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to