Hello. I am building full-ajax back-end, which consits of many quite big partials. As the system grows up, performance is problem. After every click, partial is refreshed, if needed. I am now at 0.5 sec / request. I tried to simply disable ajax and the result was quite suprising: the same page is rendered over 2x faster. I update 80% of page in case of ajax. (Please dont tell: dont use ajax when updating 80% of page... thats not the point.) So the ajax (page.replace :partial=>) is significantly slower than non-ajax? Are there ways to improve performance? I''am not very deep in rails, some suggestions? Thanks. Fero. -- 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 -~----------~----~----~----~------~----~------~--~---
On 13 Mar 2008, at 16:51, Frantisek Psotka wrote:> > Hello. > > I am building full-ajax back-end, which consits of many quite big > partials. As the system grows up, performance is problem. After every > click, partial is refreshed, if needed. I am now at 0.5 sec / > request. I > tried to simply disable ajax and the result was quite suprising: the > same page is rendered over 2x faster. I update 80% of page in case of > ajax. (Please dont tell: dont use ajax when updating 80% of page... > thats not the point.) So the ajax (page.replace :partial=>) is > significantly slower than non-ajax? Are there ways to improve > performance? I''am not very deep in rails, some suggestions?Well the first step is to workout where the bottleneck is (via ruby- prof for example, there''s a rails plugin that''s easy to use). Beyond that, it is certainly true that page.replace :partial=> is slower than just a plain old render, since on top of the normal render, the result of the render must be turned into a javascript string (escaping quotes in it for example), and then on the other end the browser does the exact opposite. I remember finding it a big sluggish with large chunks of html. Fred --~--~---------~--~----~------------~-------~--~----~ 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 actualy found that cca half of request is in String#gsub, in 90% called by String#to_json. Any idea how I should improve performance? -- 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 -~----------~----~----~----~------~----~------~--~---
Frantisek Psotka wrote:> I actualy found that cca half of request is in String#gsub, in 90% > called by String#to_json. Any idea how I should improve performance?maybe by using http://json.rubyforge.org/ c-variant of String#to_json But, how can I do that? -- 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 -~----------~----~----~----~------~----~------~--~---
Ok, my first performance-tunning success: Using http://json.rubyforge.org/ the time calling String#to_json drops to 4%, which improves overall rendering performance by 30%. Thank you for attention :) F. -- 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 -~----------~----~----~----~------~----~------~--~---