title: Any way to improve the performance of this Applescript iTunes Code?
body: <p>I wrote a script that would identify duplicates in iTunes, find their instances in playlists, and other things which I don't think are relevant.  In order to check if a track is a duplicate, I have the following code:</p>
  
  <pre><code>        set duplicateSongs to ¬
          get (every track of playlist 1 where ¬
              (name is equal to (name of currentTrackToCheck as text) and ¬
                  database ID is not equal to (database ID of currentTrackToCheck as integer) and ¬
                  time is equal to (time of currentTrackToCheck as text)))
  </code></pre>
  
  <p>I wrote and tested this against a test library with 1,000 songs and it was speedy.  When I tested it against my iTunes library which is about 30,000 songs, then all hell broke loose.</p>
  
  <p>That snippet of code takes 2 minutes to finish processing!  Is there any way to make this faster code-wise?  I've been reading a lot on AppleScript and I believe using where/whose is the fastest way to filter down results from a query.</p>
  
  <p>Thanks! :-)</p>