title: Objective-C file writing process become slower and slower as more files to be produced
body: <p>This is the main part of my ObjC epub files encryptor code</p>
  
  <pre><code>@autoreleasepool {
      for(NSMutableString* epub in self.epubs){
          bookKey = [[NSMutableString alloc] initWithString:[self genRandStringLength:16]];
          [self performSelectorOnMainThread:@selector(encrypt:) withObject:[NSArray arrayWithObjects:epub,bookKey,nil] waitUntilDone:YES];
      }
  }
  </code></pre>
  
  <p>The selector "encrypt" includes these method calls</p>
  
  <ul>
  <li>create folder for epub extraction</li>
  <li>unzip epub file and put the content files into extraction folder</li>
  <li>create ZipFile for encrypted epub</li>
  <li>read each files within extraction folder, create ZipWriteStream and encrypt the file data </li>
  <li>write each encrypted data stream into ZipFile</li>
  <li>close ZipFile and change zip name extension to .epub</li>
  </ul>
  
  <p>The process is quiet fast when it is just started. But the process getting slower and slower as more file had been written. i'm so sorry for i cannot expose the selector's definition because of my company secrecy policy. but i'm very sure the problem isn't come from it. Below is the console log sample. actually those files are just the clone of the same file with different name</p>
  
  <ul>
  <li>Epub Name : A.epub
  <ul>
  <li>Book Key : 4151FDD721564E40</li>
  <li>Time taken : 0.440156  </li>
  </ul></li>
  <li>Epub Name : B.epub
  <ul>
  <li>Book Key : BC23C09C4625429E</li>
  <li>Time taken : 0.675541  </li>
  </ul></li>
  <li>Epub Name : C.epub
  <ul>
  <li>Book Key : AF872798FAEA4EDE</li>
  <li>Time taken : 0.974213</li>
  </ul></li>
  <li>Epub Name : D.epub
  <ul>
  <li>Book Key : 250C319928E54D2C</li>
  <li>Time taken : 1.332154  </li>
  </ul></li>
  <li>Epub Name : E.epub
  <ul>
  <li>Book Key : EC4EC65605D246EB</li>
  <li>Time taken : 1.705329</li>
  </ul></li>
  <li>Epub Name : F.epub
  <ul>
  <li>Book Key : E10588A8CB584ACD</li>
  <li>Time taken : 2.209807</li>
  </ul></li>
  <li>Epub Name : G.epub
  <ul>
  <li>Book Key : 9B572BF9428E4DFB</li>
  <li>Time taken : 2.797980</li>
  </ul></li>
  <li>Epub Name : H.epub
  <ul>
  <li>Book Key : BC05B2A629C44A85</li>
  <li>Time taken : 3.389614</li>
  </ul></li>
  <li>Epub Name : I.epub
  <ul>
  <li>Book Key : 79DB7AAFC8CA4655</li>
  <li>Time taken : 4.936718</li>
  </ul></li>
  <li>Epub Name : J.epub
  <ul>
  <li>Book Key : B0413DF2356048A7</li>
  <li>Time taken : 5.441939</li>
  </ul></li>
  </ul>