Re: a question about accessing list items through a reference
Re: a question about accessing list items through a reference
- Subject: Re: a question about accessing list items through a reference
- From: Tetsuro KURITA <email@hidden>
- Date: Thu, 7 Jun 2007 19:35:59 +0900
Thanks for you response.
> <script>
> script AScript
> property a_list : {1, 2}
> end script
>
> set l to AScript's a_list -- this is the "get"
>
> repeat with ref_to_item in l
> set contents of ref_to_item to 3
> end repeat
> </script>
>
Unfortunately above script is slow.
Indirect access to a list is important for the performance.
on run
set num_list to {}
repeat with n from 1 to 1000
set end of num_list to n
end repeat
script AScript
property a_list : num_list
end script
set l to AScript's a_list -- this is the "get"
set time1 to GetMilliSec
repeat with ref_to_item in l
if ref_to_item > 100 then
set contents of ref_to_item to 3
end if
end repeat
set time2 to GetMilliSec
set l to a reference to AScript's a_list
repeat with ref_to_item in l
if ref_to_item > 100 then
set contents of ref_to_item to 3
end if
end repeat
set time3 to GetMilliSec
{time2 - time1, time3 - time2} -- result : {343.0, 41.0} msec
end run
=======================================================
Tetsuro KURITA
E-mail: email@hidden
http://homepage.mac.com/tkurita/scriptfactory/en/
=======================================================
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden