title: how to avoid high cpu usage when reading large files
body: <p>My project loads hugh list of string into the listview, using BackgroundThread,it did very fast performance but takes nearly 100% cpu is there any workaround to avoid high cpu usage without reducing its performance? I use netframework 3.5</p>
  
  <p>The code:</p>
  
  <pre><code>        void readfile() {
  
          deg_readfile read = new deg_readfile(readfileasync);
          read.BeginInvoke(new AsyncCallback(callback),null);
      }
  
      void readfileasync(){
          string[] strs = File.ReadAllLines("hughlist.txt");
          List&lt;ListViewItem&gt; _itemlst = new List&lt;ListViewItem&gt;();
          ListViewItem _item;
          int x = 0;
          //problem start here
          foreach (string str in strs) {
              _item = new ListViewItem(str);
  
              for (int i = 0; i &lt; 6; i++) {
                  _item.SubItems.Add("");              
              }              
              _itemlst.Add(_item);
              x++;
              _item = null;
          }
      }
  
      void callback(IAsyncResult ae) {
          Console.WriteLine("finished");
  
      }
  
      delegate void deg_readfile();
  
      static void Main(string[] args)
      {
          Program prog = new Program();
  
          Thread t=new Thread(new ThreadStart(prog.readfile))
          {
              IsBackground = true,
              Priority = ThreadPriority.Lowest
  
          };
          t.SetApartmentState(ApartmentState.MTA);
          t.Start();
          Console.Read();
  
      }
  </code></pre>
  
  <p>Thanks in advance.</p>
  
  <p>update:</p>
  
  <p>System configuration :</p>
  
  <p>Processor : Intel(R) Core(TM) i3-2328M CPU @ 2.20GHZ 2.11 GHZ
  Installed memory : 1.00 GB
  System type: 32-bit operating system</p>
  
  <p>The file has 35,939 KB size with 1 millions lines</p>