The jquery statement
$(selector).find(":input[data-val=true]").each(....) - line 173 jquery.validate.unobtrusive.js within the Parse(selector) method.
Provides better performance if it is re-written as a chained statement, oppose to as a single selector:
$(selector).find("input").filter["data-val=true]").each(..)
This is because it allows JQuery to use less of the Sizzle engine (which is known to be poor). On a large DOM, it has shown performance improvements of an order of magnitude firing the DOMContentLoaded event.
We have reduced the duration of our Document ready method from 700ms to 300ms.
Thanks,
Comments: The point still stands. The changes made are now SLOWER than they were before. http://jsperf.com/jquery-unobtrusive-find-performance/5 - See "Suggested Code", for an example of what changes were made. Revision one does not reflect the changes made as it does not use the ":Input", but only "Input", so this is a bad reflection of the issue being fixed. Please see: http://jsperf.com/jquery-unobtrusive-find-performance/6 For something that returns the same results, but is much more performant. I have made MS suggested, which is what has been committed, and Stu Suggested, for which is what I suggest.
$(selector).find(":input[data-val=true]").each(....) - line 173 jquery.validate.unobtrusive.js within the Parse(selector) method.
Provides better performance if it is re-written as a chained statement, oppose to as a single selector:
$(selector).find("input").filter["data-val=true]").each(..)
This is because it allows JQuery to use less of the Sizzle engine (which is known to be poor). On a large DOM, it has shown performance improvements of an order of magnitude firing the DOMContentLoaded event.
We have reduced the duration of our Document ready method from 700ms to 300ms.
Thanks,
Comments: The point still stands. The changes made are now SLOWER than they were before. http://jsperf.com/jquery-unobtrusive-find-performance/5 - See "Suggested Code", for an example of what changes were made. Revision one does not reflect the changes made as it does not use the ":Input", but only "Input", so this is a bad reflection of the issue being fixed. Please see: http://jsperf.com/jquery-unobtrusive-find-performance/6 For something that returns the same results, but is much more performant. I have made MS suggested, which is what has been committed, and Stu Suggested, for which is what I suggest.