javier ramirez
2006-Aug-22 18:30 UTC
[Rails-spinoffs] performance slowdown in when creating scriptaculous sortable with many children
Hi, I''m using scriptaculous for making two elements sortable and also for moving children between each other. The code I''m using is pretty straight forward. I have two divs, and i''m sorting the <p> elements inside (i tried first with ul/li and the results were the same, just in case you were wondering). A bit below you can find the piece of code I''m using. Bottom line is, when the children in the element are a small number, then everything goes perfect, but when the element has a lot of children (~200) then there is a huge slowdown in performance. From the moment I click until the script responds and lets me actually move the children some seconds can pass by. I have observed this behaviour both on Mozilla and IE. Any suggestions to improve performance here? in case you are curious, my code for making the element sortable is below thanks!! j <%= sortable_element("divSourceFields" , :dropOnEmpty=>true, :containment => ["divSourceFields","divTargetFields"], :constraint =>false, :hoverclass => ''"over"'' , :scroll => ''"divSourceFields"'', :scrollSensitivity => ''1'', :scrollSpeed => ''100'', :ghosting => true, :tag => ''p'' ) %> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
petermichaux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Aug-23 02:41 UTC
[Rails-spinoffs] Re: performance slowdown in when creating scriptaculous sortable with many children
javier ramirez wrote:> Hi, > > I''m using scriptaculous for making two elements sortable and also for > moving children between each other. The code I''m using is pretty > straight forward. I have two divs, and i''m sorting the <p> elements > inside (i tried first with ul/li and the results were the same, just in > case you were wondering). A bit below you can find the piece of code I''m > using. > > Bottom line is, when the children in the element are a small number, > then everything goes perfect, but when the element has a lot of children > (~200) then there is a huge slowdown in performance. From the moment I > click until the script responds and lets me actually move the children > some seconds can pass by. I have observed this behaviour both on Mozilla > and IE. > > Any suggestions to improve performance here?I think the problem is the way that the library searches the drop regions with every drag. It has to loop through the drop target regions with every move, calculate the positions and then see if the cursor is inside one. This will be slow and I think difficult to overcome. The Yahoo! UI dragdrop library is the same. I have ~1000 draggables and had to take a new approach that doesn''t slow down no matter how many daggables and targets http://peter.michaux.ca/articles/2006/08/09/donut-dragdrop-release Peter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
javier ramirez
2006-Aug-23 10:34 UTC
Re: performance slowdown in when creating scriptaculous sortable with many children
I''ll take a look at your library.. It''s a shame it''s pure javascript and (still) with no helper for using it directly from rails, but it looks interesting nevertheless. Thank you very much :) regards, j petermichaux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> javier ramirez wrote: > >> Hi, >> >> I''m using scriptaculous for making two elements sortable and also for >> moving children between each other. The code I''m using is pretty >> straight forward. I have two divs, and i''m sorting the <p> elements >> inside (i tried first with ul/li and the results were the same, just in >> case you were wondering). A bit below you can find the piece of code I''m >> using. >> >> Bottom line is, when the children in the element are a small number, >> then everything goes perfect, but when the element has a lot of children >> (~200) then there is a huge slowdown in performance. From the moment I >> click until the script responds and lets me actually move the children >> some seconds can pass by. I have observed this behaviour both on Mozilla >> and IE. >> >> Any suggestions to improve performance here? >> > > I think the problem is the way that the library searches the drop > regions with every drag. It has to loop through the drop target regions > with every move, calculate the positions and then see if the cursor is > inside one. This will be slow and I think difficult to overcome. The > Yahoo! UI dragdrop library is the same. I have ~1000 draggables and had > to take a new approach that doesn''t slow down no matter how many > daggables and targets > > http://peter.michaux.ca/articles/2006/08/09/donut-dragdrop-release > > Peter > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Peter Michaux
2006-Aug-23 17:14 UTC
Re: performance slowdown in when creating scriptaculous sortable with many children
On 8/23/06, javier ramirez <jramirez-7iWCczGtl7hBDgjK7y7TUQ@public.gmane.org> wrote:> > I''ll take a look at your library.. It''s a shame it''s pure javascript and > (still) with no helper for using it directly from railsGiven the flexibility of the library design it would take a little different approach to build the rails helpers. There would need to be a helper that would assemble the dragdrop manager from the appropriate layers. This helper would probably need to be in the head section of layout.rhtml I don''t know that wrapping this library in rails helpers is necessary or definitely a good idea. The idea of the library is to put the flexibility and control in the hands of a JavaScript programmer. To really implement this library, I thnk the programmer would have to know JavaScript and about inheritance in JavaScript etc. I wouldn''t want to port the donut dragdrop library from Yahoo! UI dependency to Prototype.js dependency until Prototype.js 2.0 arrives and shows that it has a lot of good changes. Peter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---