This project has moved and is read-only. For the latest updates, please go here.

Long time to compute on heavy requests?

Sep 13, 2011 at 4:52 PM

Hello Marc and everyone,

I am using SPServices to gather data and draw graphs with an other plugin (flot).

Up until now, I was trying to optimise my code to have the page show faster, but after having done most of whwat I can, I tried to see what point takes the longer time (both with big lists and very little ones).

The problem I ran in is that even if WebServices are damn slow to answer due to the server, the SPServices also takes a good amount of time to compute between the time I call and the time I can act again.


As an example, I have a list with 140 items, so just a medium one for what I am doing.

The first request took 0.7 seconds to execute on a very little list (5 items).

The web services themselves took 109 ms (Web.asmx) and 316 ms (Lists.asmx).

So it is safe to assume that the rest is taken by SPServices, before the request and after.


The subsequent calls to little lists don't show such high differences (290ms vs 305ms etc).

Then comes the big list, and again, the difference is quite big: 188 ms for Lists.asmx and 584 ms SPService call.


I assume that all this lag is not due exclusively to SPServices (maybe timers and all the system behind ajax calls), but do I have to expect more than a second of diference for lists with 1000+ items?


As it is really a concern for big lists, I wanted to ask here first hand before going into optimisation of a code that's not mine and already pretty much optimised.


I hope someone can answer, and maybe give me a hint on how to use it more efficiently.


Thanks in advance.

Sep 14, 2011 at 1:50 AM

I'm not sure what SPServices could be doing that would take a long time. If you're just doing basic Web Services calls (like GetListItems), SPServices is doing very little except passing the parameters you provide to the .ajax() function. It's also hard to know what you are doing without seeing your code.


Sep 14, 2011 at 8:54 AM

Ok, so as I only call GetListItems and GetListViews, all that delay comes from Ajax libraries.

I figured it too after trying various things, as it seems that Ajax does a little work on returned items for them to be usable by JS code.

So the more you ask to the Web Services, the longer it will take, even with fast responding servers.

Thank you for your answer, if I figure out something to accelerate the process, I'll come to tell.