I have an MVS project where I use an AJAX to retrieve an array... The following is my class on C#... I retrieve a list of 19,500 records... basically I pull an IEnumerable
public partial class VW_Suppliers
{
public int SupplierID { get; private set; }
public string Name { get; private set; }
public int SolarNumber { get; private set; }
public bool TpiClassification { get; private set; }
public int ValueStreamID { get; private set; }
public string ValueStream { get; private set; }
public int StatusID { get; private set; }
public string Status { get; private set; }
public string SupplierCode { get; private set; }
public int PurchaseSystemID { get; private set; }
public string PurchaseSystem { get; private set; }
public int AddressID { get; private set; }
public int AddressTypeID { get; private set; }
public string AddressType { get; private set; }
public string Street1 { get; private set; }
public string Street2 { get; private set; }
public string PoBox { get; private set; }
public string City { get; private set; }
public string PostalCode { get; private set; }
public int StateID { get; private set; }
public string StateCode { get; private set; }
public string State { get; private set; }
public int CountryID { get; private set; }
public string CountryCode { get; private set; }
public string Country { get; private set; }
}
[HttpGet]
public ActionResult GetSuppliersData()
{
JsonObject jsonObject;
IEnumerable<ViewSupplierVM> suppliers = _supplierService.GetAllSuppliers();
JsonResult jsonResult = Json(suppliers, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
}
However, I noticed two things... when using breakpoints I noticed that after I hit return... it takes around 10 seconds for AngularJS to hit the breakpoint when the data is received. Second problem is that whenever the page is ready with all data... the overall site is rather slow... for instance.. you type on a textbox, and everything appears from 0.5 to 4 seconds after typing... which leads me to believe that that array of 19,500 elements is consuming to much memory...
It is required that all suppliers appear on the first screen, so there is no way to turn this requirement around.
Any tips? What tricks could be done on the MVC controller to send to front end faster and prevent site from being to slow?