In a current project the client asked for the possibility of answering a questionnaire in two ways: using a Wizard (one question at a time) and Listing (all questions at once) in a single form. Both ways are already implemented.

The questions are loaded from the database per Manual's chapter using AJAX (this is super fast). The biggest chapter at the moment has 230 questions (each with 4 HTML input fields - input/text, select, etc). If the user selects such Chapter to answer in the Listing format, the <form> will contain at about 920 fields to be posted to the server.

I'm doing an AJAX POST request passing the data with jQuery's serialize method:

data: $("#questions :input").serialize()

This serialization takes 207.143ms to complete. I got this value debugging with Firebug in Firefox:

console.profile();
$("#questions :input").serialize();
console.profileEnd();

Again this is super fast...

The problem comes when hydrating the data received on the following action method:

public async Task<ActionResult> ListSaveAsync(IEnumerable<AnswerViewModel> questions)

As you see, the posted data is data bound to an IEnumerable<AnswerViewModel> questions. AnswerViewModel has only 4 fields to store each answer.

The thing is that it takes a considerable amount of time (precisely 10 seconds) after clicking the Save button to hit a breakpoint on this action method, that is, those 10 seconds are being spent in the model binder presumably.

An important thing to mention is that I'm using Steve Sanderson's @Html.BeginCollectionItem helper to help when materiali

Edit
Report