• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Working with big lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working with big lists


  • Subject: Re: Working with big lists
  • From: has <email@hidden>
  • Date: Mon, 23 May 2005 10:37:18 +0100

Rob Stott wrote:

>>Use a more efficient algorithm. You should only need to scan each line in the file once, whereas your current routine scans each line N times (where N is the number of lines in the file) - horribly inefficient.

[minor correction to above: should read "where N is the number of unique lines", which in the worst case is same as the number of lines in the file]


>Yep, that's what was bothering me - it seemed like a nasty way of going about it but I couldn't think of an alternative. That chunk of Python REALLY speeds things up. Thanks for that.

Dunno how it compares to the sort + unique approach for raw speed (either via shell or rolling your own in vanilla AS), though I think the dictionary-based counter approach is more elegant and flexible. Satimage's XMLLib osax would probably be the best third-party dictionary substitute if you want to do it in AS. Either way, what matters is avoiding the quadratic-or-worse inefficiencies of the naive algorithm, as that's what really kills you as the amount of data rises.

HTH

has
--
http://freespace.virgin.net/hamish.sanderson/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Working with big lists (From: has <email@hidden>)
 >Re: Working with big lists (From: Rob Stott <email@hidden>)

  • Prev by Date: RE: Remote AppleEvents for Folder Path
  • Next by Date: Running this script without the "Enable access for assistive devices" box checked
  • Previous by thread: Re: Working with big lists
  • Next by thread: Re: Working with big lists
  • Index(es):
    • Date
    • Thread