title: Linq to SQL, InsertOnSubmit vs. InsertAllOnSubmit performance?
body: <p>Is there a huge difference in performance between the two, for instance I have these two code snippets:</p>
  
  <pre><code>public void Insert(IEnumerable&lt;ManageGeofenceViewModel&gt; geofences)
  {
      var insertGeofences = new List&lt;Geofence&gt;();
  
      foreach(var geofence in geofences)
      {
          Geofence insertGeofence = new Geofence
          {
              name = geofence.Name,
              radius = geofence.Meters,
              latitude = geofence.Latitude,
              longitude = geofence.Longitude,
              custom_point_type_id = geofence.CategoryID
          };
  
          insertGeofences.Add(insertGeofence);
  
      }
  
      this.context.Geofences.InsertAllOnSubmit(insertGeofences);
      this.context.SubmitChanges();
  }
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>public void Insert(IEnumerable&lt;ManageGeofenceViewModel&gt; geofences)
  {
      foreach(var geofence in geofences)
      {
          Geofence insertGeofence = new Geofence
          {
              name = geofence.Name,
              radius = geofence.Meters,
              latitude = geofence.Latitude,
              longitude = geofence.Longitude,
              custom_point_type_id = geofence.CategoryID
          };
          this.context.Geofences.InsertOnSubmit(insertGeofence);
      }
      this.context.SubmitChanges();
  }
  </code></pre>
  
  <p>Which among the two is better and does the two code snippet have the same number of trips to the database since in the 1st snippet submitchanges was called outside of the loop?</p>