So, I have a vote button that when clicked uses link_to_remote to call a controller method vote, which logs the vote, then calls vote.rjs to do a replace_html on the div that holds the vote button, which in turn changes the image. Even if I take all the code out of the controller it still take a LONG time to for the replace_html to work its magic. Do you guys think this is something I''m doing, the nature of rjs, or is it the nature of Element.update? Thanks. JB --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can test this yourself. Just scribble out a quick (X)HTML page and include prototype.js. Then run something like 1000 replace_html operations inside a timer. Judge for yourself. Or, even quicker, look at your logs and see how quickly your server is turning remote requests around. For my projects, the "magic" is quick enough to produce credible live preview text editing so I''m guessing you''re not getting the responsiveness you expect on the round-trip to the server. Still, it never hurts to measure. On Jan 16, 2008, at 9:30 PM, Jables wrote:> > So, I have a vote button that when clicked uses link_to_remote to call > a controller method vote, which logs the vote, then calls vote.rjs to > do a replace_html on the div that holds the vote button, which in turn > changes the image. Even if I take all the code out of the controller > it still take a LONG time to for the replace_html to work its magic. > Do you guys think this is something I''m doing, the nature of rjs, or > is it the nature of Element.update? Thanks. > > JB > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''d assume its a request response thing as well remember that you will get a huge efficiency boost when you move into production. also depending on your set up you could try caching the js to improve rendering time (check your logs to see if thats where the problem is, i would assume its just normal cgi problems) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---