Alternatives to RJS

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 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.

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)