There are cases in which rjs is not optimal.
If your ajax call generates a large amount of rhtml then that rhtml has
So if your rjs is just page.replace_html foo or page.insert_html foo
then you are often better off using the :update option of link_to_remote
Yes it appears escaping is the culprit. Adding the to_json patch from
http://dev.rubyonrails.org/ticket/3473 seems to help considerably,
getting used somewhere else. And performance could be better even
I’m not really concerned with browser side performance. We are talking
5K worth of data, is that ‘large amount’? So, I’m guessing that
link_to_remote :update doesn’t need to have anything escaped would be
the difference… unfortunately, that sort of limits my options. Ie.
If someone tries to adjust a slider when they arent logged in, I want to
update a flash div, as well as redraw the sliders back to their unmoved
state, for example.
Are the internals of gsub able to handle this stuff efficiently? Ie.,
are too many reallocation/copies happening because of the number of
extra chars that are being added to escape the various punctuation and
whitespace? Are there ways to have it preallocate enough space (2x the
string size would be the obvious choice, in the worst case scenario of
all escaped chars.) And this really kind of screws with fragment caching
lol…I don’t care how you do it, 500% increase in rendering time due
to escaping is pretty bad.