I am working on a page that has a dynamically generated markup. And as such, I have no idea what fields are available on the form. So instead of creating a view model, the POST method uses the FormCollection. Once the POST is received, the program runs quickly.
My problem: Clicking SUBMIT on the form will take about 10 - 15 seconds to hit a breakpoint on the first line of the POST action in the controller. In my scenario, there are 800 input fields on the form. Does it really take this long to create the FormCollection for only 800 fields? Are there any ways to streamline the process or improve the response time?
EDIT:
The IE profiler indicates the majority of time is spent in the JQuery CSS selector. If I remove all CSS, the page works very quickly. Why is the CSS selector running prior to posting back to the server? Can I disable it?
EDIT 2: The profiler is now showing time spend in JQuery 1.6.4.min.js, the function is 'k'. I think that is just an internal varialble lookup. I have also found that removing the 'size' and 'maxlength' attributes from the input fields makes the page respond quickly (hooray)... except... I need those for client side validation. I'm still trying to find a way to improve the speed, or remove the attributes and retain some way to limit the input length of the fields on the client side.
Edit 3: I've dug into the jquery-1.6.4.min.js and found function k. Per Edit 2, adding/removing the 'maxlength' and 'size' attributes makes all the difference (33K ms instead of 3k ms). However, function K should not do much... as those are not nodetype===1 and the first IF should fail, returning out of the function on the next line.
function k(a,c,d)
{
if(d===b&&a.nodeType===1)
{
var e="data-"+c.replace(j,"-$1").toLowerCase();
d=a.getAttribute(e);
if(typeof d=="string")
{
try
{
d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)
}
catch(g){}
f.data(a,c,d)
}
else
d=b
}
return d
}