I tried using ".find" in place of ".SPFilterNode" and there is no noticeable difference. Admittedly, I have no experience with the "Promise" object but I do see more information on it regularly. Alas, I will have to learn it in time ;-) However, I don't believe that will help me here.
I did some more testing today and discovered the lag isn't in the iteration of the returned XML (as I originally suspected) but rather in trying to insert the strHTML I build from it into the DOM. In my example code, I run the ".each()" method to iterate over all of the 'User' elements (>13,000). In every combination of jQuery and SPServices I tried, I'm able to get the XML return in about 3.4 seconds and complete the iteration in about 1 additional second--no problem there. The difference is in the time it takes to append my <select> control (id = 'users_SiteUsers') with the string of options (>13000). As long as I'm running jQuery 1.8.3 or earlier, I can complete the insertion in about 1.9 seconds. As soon as I upgrade to 1.10 or later, the insertion time ramps up to about 67.7 seconds. I tried using the following variants and came up with the same result each time:
FYI, here's the latest version of the test script that includes the time hacks....
I did some more testing today and discovered the lag isn't in the iteration of the returned XML (as I originally suspected) but rather in trying to insert the strHTML I build from it into the DOM. In my example code, I run the ".each()" method to iterate over all of the 'User' elements (>13,000). In every combination of jQuery and SPServices I tried, I'm able to get the XML return in about 3.4 seconds and complete the iteration in about 1 additional second--no problem there. The difference is in the time it takes to append my <select> control (id = 'users_SiteUsers') with the string of options (>13000). As long as I'm running jQuery 1.8.3 or earlier, I can complete the insertion in about 1.9 seconds. As soon as I upgrade to 1.10 or later, the insertion time ramps up to about 67.7 seconds. I tried using the following variants and came up with the same result each time:
$("#users_SiteUsers").append(strHTML);
$(strHTML).appendTo("#users_SiteUsers");
$("#users_SiteUsers").html(strHTML);
I get the same results on IE8 and IE10. I now am sure that none of this is related to SPServices but is certainly good info to have for SPServices users. I will try to get on the jQuery user forum to bring this up but my network configuration is very restricted and to date, I've not been able to get the forum pages to function on my machine. It would be nice to know if you are able to duplicate the issue in your environment with a large list.FYI, here's the latest version of the test script that includes the time hacks....
var dtTimeStart = new Date();
var lngTimeStart = dtTimeStart.getTime();
var lngTimeReturn;
var lngTimeIterationEnd;
console.log("");
console.log("Start: " + dtTimeStart);
var strHTML = "";
$().SPServices({
operation: "GetUserCollectionFromSite",
async: false,
completefunc: function(xData, Status) {
lngTimeReturn = new Date().getTime();
console.log("Seconds to Return: " + (((lngTimeReturn - lngTimeStart) / 1000).toFixed(2)));
$(xData.responseXML).find("User").each(function() {
strHTML += "<option value='" + $(this).attr("LoginName") + "'>" + $(this).attr("Name") + "</option>";
});
lngTimeIterationEnd = new Date().getTime();
console.log("Seconds to Iterate Return Data: " + (((lngTimeIterationEnd - lngTimeReturn) / 1000).toFixed(2)));
}
});
$("#users_SiteUsers").append(strHTML); //Slow and painful using jQuery >= 1.10.x
var dtTimeEnd = new Date();
console.log("End: " + dtTimeEnd);
console.log("Seconds to append select control: " + (((dtTimeEnd.getTime() - lngTimeIterationEnd) / 1000).toFixed(2)));
console.log("Total Time: " + (((dtTimeEnd.getTime() - lngTimeStart) / 1000).toFixed(2)));
Geoff