Schmitty
2007-Oct-03 13:00 UTC
Script.aculos.us and prototype performance issue with many items
We are using Script.aculos.us for a quoting application. Some of the quotes can contain many line items. We allow the users to group line items and are using sortables and drag and drop to allow the users to sort within a group and across groups. However, it seems when we reach about 100 line items performance start to degrade. Also, after the user drags an item we make an Ajax call to update the sort order and persist it. The Ajax call returns the HTML to replace the entire list/groups of items. When there is about a 100 items the display is not refreshed correctly. It seems that perhaps the Ajax returned HTML might be replacing a portion of the DOM that Script.aculos.us/prototype is still processing. Any suggestions on how to improve performance? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Riccardo De Agostini
2007-Oct-03 13:27 UTC
Re: Script.aculos.us and prototype performance issue with many items
> Also, after the user drags an item we make an Ajax call to update the > sort order and persist it. The Ajax call returns the HTML to replace > the entire list/groups of items. When there is about a 100 items the > display is not refreshed correctly. It seems that perhaps the Ajax > returned HTML might be replacing a portion of the DOM that > Script.aculos.us/prototype is still processing. > > Any suggestions on how to improve performance?I was having a similar problem in an application currently (STILL!!, my customer would add :-) under development. In the end I resorted to having the Ajax call return mere data (an array of Javascript objects representing items in a list) and generating HTML client-side, using Prototype''s Template class. Yuor case, however, may be simpler since, if I understand correctly, once the user has dragged an item you already have the ordered list on your page; thus the Ajax call does not need, IMHO, to return anything if not "OK" or something of the kind, and you would just have to handle the occasional failure, e.g. by simply reissuing the call. Ric --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Alex Duffield
2007-Oct-03 15:08 UTC
Re: Script.aculos.us and prototype performance issue with many items
if you make a ajax request to replace the full list after each time the user reorders something in the list, you run the risk of the request taking longer to return from the server than you would expect. If the users makes another change, before the first response gets back from the server, then you have to requests pending. I have seen it happen quite often that those 2 requests do not come back in the same order they where sent, hence your list gets out of sync with what the user is doing.. ie: drag one ajax request one sent drag two ajax request two sent ajax request two response received ajax request one response received Also I could see a serious problem if your list is updated with new HTML while you are in the middle of dragging something to change its order. I am not sure (from what you have said) why you would need to have the response replace the HTML of the list after drag? in the simple case of one order change, you send the new order off to the server. Now the server knows (sees) what the user sees in terms of the order.. The html that your response sends back would be the same as what the user sees as the sortable already changed the HTML... Unless you are updating/ changing other information in the list server side... ______________________________________________________________________ Alex Duffield ❖ Principal ❖ InControl Solutions . http:// www.incontrolsolutions.com On 3-Oct-07, at 6:00 AM, Schmitty wrote:> > We are using Script.aculos.us for a quoting application. Some of the > quotes can contain many line items. We allow the users to group line > items and are using sortables and drag and drop to allow the users to > sort within a group and across groups. However, it seems when we > reach about 100 line items performance start to degrade. > > Also, after the user drags an item we make an Ajax call to update the > sort order and persist it. The Ajax call returns the HTML to replace > the entire list/groups of items. When there is about a 100 items the > display is not refreshed correctly. It seems that perhaps the Ajax > returned HTML might be replacing a portion of the DOM that > Script.aculos.us/prototype is still processing. > > Any suggestions on how to improve performance? > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Schmitty
2007-Oct-04 14:51 UTC
Re: Script.aculos.us and prototype performance issue with many items
Thanks for your post. We had been updating the whole container because moving items between groups affected sub-totaling for the groups affected. However, we did fix the issue. We took your suggestion of not updating the whole containing DIV tag via the Ajax call, but instead updating only the sub-total and total rows using evaluated JavaScript returned from the Ajax call. Thus modifying the HTML elements in place. This did fix the display errors we were seeing and improved performance. Thanks again. On Oct 3, 10:08 am, Alex Duffield <A...-GLL9njBnHiGqPKKiFzS5XxZCeNDtXRbv@public.gmane.org> wrote:> if you make a ajax request to replace the full list after each time > the user reorders something in the list, you run the risk of the > request taking longer to return from the server than you would > expect. If the users makes another change, before the first response > gets back from the server, then you have to requests pending. I have > seen it happen quite often that those 2 requests do not come back > in the same order they where sent, hence your list gets out of sync > with what the user is doing.. > > ie: > drag one > ajax request one sent > drag two > ajax request two sent > ajax request two response received > ajax request one response received > > Also I could see a serious problem if your list is updated with new > HTML while you are in the middle of dragging something to change its > order. > > I am not sure (from what you have said) why you would need to have > the response replace the HTML of the list after drag? in the simple > case of one order change, you send the new order off to the server. > Now the server knows (sees) what the user sees in terms of the > order.. The html that your response sends back would be the same as > what the user sees as the sortable already changed the HTML... Unless > you are updating/ changing other information in the list server side... > > ______________________________________________________________________ > Alex Duffield ❖ Principal ❖ InControl Solutions . http://www.incontrolsolutions.com > > On 3-Oct-07, at 6:00 AM, Schmitty wrote: > > > > > We are using Script.aculos.us for a quoting application. Some of the > > quotes can contain many line items. We allow the users to group line > > items and are using sortables and drag and drop to allow the users to > > sort within a group and across groups. However, it seems when we > > reach about 100 line items performance start to degrade. > > > Also, after the user drags an item we make an Ajax call to update the > > sort order and persist it. The Ajax call returns the HTML to replace > > the entire list/groups of items. When there is about a 100 items the > > display is not refreshed correctly. It seems that perhaps the Ajax > > returned HTML might be replacing a portion of the DOM that > > Script.aculos.us/prototype is still processing. > > > Any suggestions on how to improve performance?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---