linqweb-servicesajaxcontroltoolkitautocompleteextendertoolkitscriptmanager

why AutoComplete Extender work very slow ASP.NET


Fixed: Missing Property CompletionInterval="0"

I am testing functionalities of ajax autocomplete extender and webservices. And found that auto complete extender take a while to fetch the data and display. I don't have database connection or anything like that at the moment. I am just putting all the items in a array in the webservice function and return the matching set of items using LINQ. There is about 1 second gap showing the data. I tried turned on/off EnableCaching which I found someone suggested that on a blog but it still very slow comparing how Google searches billions of data and returns you the result on the live website with billions of users without a fraction of a second delay.

Although Google won't use asp.net, Linq or script manager to do Ajax work, I am just testing on my local computer, with no database connection, I assume there must be a way to make it work faster. Probably I missed to set a setting somewhere. Here is my code.

aspx

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>

    <asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox>

    <asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" ServiceMethod="HelloWorld" MinimumPrefixLength="1" EnableCaching="false" CompletionListCssClass="CompletionListCssClass"
    DelimiterCharacters="" Enabled="True" ServicePath="WebService.asmx" TargetControlID="TextBox1"> 
    </asp:AutoCompleteExtender>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Search" />

There is nothing on code_behind.

Here is code for webservice ..

    <System.Web.Script.Services.ScriptService()> _
    <WebService(Namespace:="http://tempuri.org/")> _
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class WebService
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld(prefixText As String) As String()

    Dim str() As String = {"Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan",
                            "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei",
                            "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic",
                            "Chad", "Chile", "China", "Colombi", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus",
                            "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador",
                            "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana",
                            "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia",
                            "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North",
                            "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania",
                            "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius",
                            "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepa", "Netherlands",
                            "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay",
                            "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent",
                            "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore",
                            "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland",
                            "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda",
                            "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam",
                            "Yemen", "Zambia", "Zimbabwe"}

    Dim result As ArrayList = Nothing

    Dim query = From x In str
                Where x.ToLower.Contains(prefixText)
                Select x

    Return query.ToArray

    End Function

    End Class

Solution

  • Isn't there a delay property in the AutoCompleteExtender? CompletionInterval I think.