title: Core Data takes too much time
body: <p>I have around 200,000 four letter words, which i want to use in my app. I don't want to use it as a CSV file in my app. So i using core data now. Now i am loading all these values to core data at the starting of the app only for the first time. And i am retrieving these values after sometime.</p>
  
  <p>So this procedure too much time, more than 20 seconds i think. I just want to access a single word, also i just want to know whether a word already exists in the core data or not, is there any other ways to do this, except looping through the whole array.</p>
  
  <p>Simply, I want to check whether a word exists in core data or not, also i want to access a word by ints index, I don't wanna loop through all the objects. Is there any other way .? I want to do this in a fraction of a second.How am i supposed to load 0.2 million words .? Reading from CSV takes more than 2 minutes, in my app. Any suggestion for importing array of string into core data.?</p>
  
  <p>This is the code i am using in my project.</p>
  
  <pre><code> // Save it into CoreData
  
  
      func saveName()
      {
  
          //1 Getting AppDelegate
  
          let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
  
          let managedContext = appDelegate.managedObjectContext!
  
          //2 Fetching Entity Description by corresponding entityName
  
          let entity =  NSEntityDescription.entityForName("Content", inManagedObjectContext: managedContext)
  
          let tempManagedObject = NSManagedObject(entity: entity!, insertIntoManagedObjectContext:managedContext)
  
          //3 Setting Values for managedObject
  
  
          for input in self.fourLetterWords
          {
              tempManagedObject.setValue(input, forKey: self.kMainAttributeName)
          }
  
          //4
  
          var error: NSError?
  
          if !managedContext.save(&amp;error)
          {
              println("Could not save \(error), \(error?.userInfo)")
          }
      }
  
      //MARK: - Showing Values From Core Data
  
      func showOutput()
      {
          var myArray : Array&lt;String&gt; = []
  
          //1
          let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
  
          let managedContext = appDelegate.managedObjectContext!
  
          //2
          let fetchRequest = NSFetchRequest(entityName: "Content")
  
          //3
          var error: NSError?
  
          let fetchedResults =
          managedContext.executeFetchRequest(fetchRequest,
              error: &amp;error) as! [NSManagedObject]?
  
          if let results = fetchedResults
          {
              for inputObject in results
              {
                  if let value : String = inputObject.valueForKeyPath(self.kMainAttributeName) as? String
                  {
                      myArray.append(value)
                  }
              }
          }
          else
          {
              println("Could not fetch \(error), \(error!.userInfo)")
          }
      }
  </code></pre>