开发者

ASPMVC, $.getJSON, very slow

This is my first game with JSON and I am surprised how slow it is.

I am quite sure I am missing something and I'll be gratefull if someone can help.

Here is my code

$.getJSON('/localhost/CountryList', function (data)
{
   alert ("finished");
});

My countryList returns an array like this

开发者_StackOverflow社区
{"Code":"AF","Name":"Afghanistan"},
{"Code":"AX","Name":"Aland Islands"},
{"Code":"AL","Name":"Albania"},

etc....

The full size of my array is about 6K and It takes more than 1m 30s to have it rendered by the browser from my local development IIS.

When I used the compression, the size goes to 2K but the time is still 1m 20s

Is it normal that JSON is so slow?


Can you look at your interaction in Firebug or Chrome's developer tool dialog to see where the time is being spent? How is the AJAX content being generated? Is it a static resource on the server, or is there some dynamic work with some potentially lengthy database magic that needs to take place? Is it waiting for the AJAX result, or is it really in the rendering?

Also, if you host the data locally (and temporarily, for this exercise) in your page itself, is the rendering reasonably fast?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜