# Alternatives to RJS

**URL:** <https://www.ruby-forum.com/t/alternatives-to-rjs/126300>\
**Category:** Rails\
**Created:** [January 17, 2008, 6:31am UTC](https://www.ruby-forum.com/t/alternatives-to-rjs/126300 "2008-01-17T06:31:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jables](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/58956e/32.png) [@Jables](https://www.ruby-forum.com/u/Jables)\
**Post date:** [January 17, 2008, 6:31am UTC](https://www.ruby-forum.com/t/alternatives-to-rjs/126300/1 "2008-01-17T06:31:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jables](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/58956e/32.png) [@Jables](https://www.ruby-forum.com/u/Jables)\
**Post date:** [January 17, 2008, 7:35am UTC](https://www.ruby-forum.com/t/alternatives-to-rjs/126300/2 "2008-01-17T07:35:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jables](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/58956e/32.png) [@Jables](https://www.ruby-forum.com/u/Jables)\
**Post date:** [January 17, 2008, 7:50am UTC](https://www.ruby-forum.com/t/alternatives-to-rjs/126300/3 "2008-01-17T07:50:55Z")

</div>

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)
