Ok - finally got around to loading this town's census data - 43,000 names of people with a corresponding CensusId.
All of this loads at "boot" time for the page (initial ajax data call after un/pw authenication). This particular set of JSON data is 2.5 MB - and takes 1.6 seconds locally running here in the office on development machines.
The jQuery autocomplete is handing 43,000 entries perfectly - I already extended it a long time ago to tell you to be more specific if more than 200 rows were being considered for display - so until then you simply get a record count of how many it's waiting to get under...
Code:
$.extend($.ui.autocomplete, {
escapeRegex: function(value) {
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
},
filter: function(array, term) {
var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i");
var arraytoreturn = $.grep(array, function(value) {
return matcher.test(value.label || value.value || value);
});
if (arraytoreturn.length > 200) {
arraytoreturn = [{ label: "Please be more specific - " + arraytoreturn.length + " matching entries!", value: ""}];
}
return arraytoreturn;
}
});
I'll give further timings after we get the page up on a public facing server...
I also want to try running this with a browser on a low-end / low-memory machine and see if eating 2.5 MB of Javascript object space is a bad thing...