title: knockout mapping performance issue
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9709374/knockout-js-incredibly-slow-under-semi-large-datasets">Knockout.js incredibly slow under semi-large datasets</a>  </p>
  </blockquote>
  
  
  
  <p>I have the following event in my model which works fine if I only have a handful of records but if I get a couple of dozen records, IE compains that my scripts are running too slow.</p>
  
  <pre><code>    self.getTrades = function () {
  
      $.ajax({
  
          type: "GET",
          cache: false,
          url: "/_vti_bin/DBOrderService/DBOrderService.svc/GetTradesByDateSource?format=json&amp;traddate=" + self.selectedDate() + "&amp;source=" + self.selectedSource(),
          success: function (data, textStatus, jqXHR) {
              if (data.requeststatus.code === 1) {
                  var statusId = SP.UI.Status.addStatus(data.requeststatus.message);
                  SP.UI.Status.setStatusPriColor(statusId, 'red');
                  return;
              }
             debugger;
             ko.mapping.fromJS({ trades: data.trades }, mappings, self); //too slow, events are firing as items are added
              self.selectedTrade(null);
          },
          error: ajaxError
      });
  };
  </code></pre>
  
  <p>I think its because mapping is firing change notifications for each row as its added, so i want to copy the  new rows 'in bulk' to my Model.</p>
  
  <p>I tried </p>
  
  <pre><code> var temptrades = ko.mapping.fromJS(data.trades, mappings);
   self.trades=temptrades();
  </code></pre>
  
  <p>and </p>
  
  <pre><code>self.trades(temtrades);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>self.trades(temptrades();
  </code></pre>
  
  <p>But they all just breajk my model. 
  Whats the right way to copy an observable array created by the ko.mapping into my Model all at once. Is there and option on ko.mapping that will prevent firing events until the end?</p>