title: Fastest way to load an NSComboBox from an 8000 item plist
body: <p>I have a plist that is basically a list of 8000 usernames. I load this into an NSDictionary, then an array of sorted keys (because the list isn't sorted when I get it) then loop through loading into an NSComboBox.</p>
  
  <p>This works, but can take a few seconds to populate the combo box.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>// in my .h
  IBOutlet NSComboBox *comboUserList; // which is connected to a combo box in my .xib
  
  // in my .m
  
  // userInfoPlist is an NSString path to the file
  NSDictionary *userList = [NSDictionary dictionaryWithContentsOfFile:userInfoPlist];
  
  // sort user info into an array
  
  NSArray* sortedKeys = [userList keysSortedByValueUsingSelector:@selector(caseInsensitiveCompare:)];
  
  // then populate the combo box from userList in the order specified by sortedKeys
  
  for ( NSString *usersKey in sortedKeys) {
      [comboUserList addItemWithObjectValue:[userList objectForKey:usersKey]];
  }
  </code></pre>
  
  <p>So this works, but for 8000 odd entries it takes some noticeable time to populate the combo box (only a second or two on a 2011 MAcBook Air, but still noticeable). Is there a faster way to use either the NSDictionary or NSArray as a data source rather than do it in a for loop?</p>