# Improve the rendering speed of rhtml

**URL:** <https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804>\
**Category:** Rails\
**Created:** [December 19, 2006, 7:37am UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804 "2006-12-19T07:37:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![freddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://www.ruby-forum.com/u/freddy)\
**Post date:** [December 19, 2006, 7:37am UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804/1 "2006-12-19T07:37:37Z")

</div>

I found through the log file that the render of the rhtml template would  
take too much time if there exists ruby code in the rhtml files.In many  
cases,these ruby code are tied with these rhtml files closely and can  
not be decoupled from that,therefore,i have a question that,is there  
exist some way to improve the rendering speed of rhtml when some ruby  
codes are included?

---

<div class="post-metadata">

**Author:** ![freddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://www.ruby-forum.com/u/freddy)\
**Post date:** [December 19, 2006, 8:43am UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804/2 "2006-12-19T08:43:07Z")

</div>

Hi, what is too long and what are you trying to do? Could you provide  
information about your deployment OS and any oher relevant  
information?

Thanks,

-Conrad

---

<div class="post-metadata">

**Author:** ![freddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://www.ruby-forum.com/u/freddy)\
**Post date:** [December 19, 2006, 1:04pm UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804/3 "2006-12-19T13:04:12Z")

</div>

Conrad T. wrote:

> Hi, what is too long and what are you trying to do? Could you provide  
> information about your deployment OS and any oher relevant  
> information?
> 
> Thanks,
> 
> -Conrad

For example,if there exists any code that involves the db operation,even  
it is a very simple sentence, the rendering time will increase for about  
fify times of the rhtml that does not include such ruby code.

---

<div class="post-metadata">

**Author:** ![freddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://www.ruby-forum.com/u/freddy)\
**Post date:** [December 19, 2006, 1:06pm UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804/4 "2006-12-19T13:06:28Z")

</div>

Freddy wrote:

> I found through the log file that the render of the rhtml template would  
> take too much time if there exists ruby code in the rhtml files.In many  
> cases,these ruby code are tied with these rhtml files closely and can  
> not be decoupled from that,therefore,i have a question that,is there  
> exist some way to improve the rendering speed of rhtml when some ruby  
> codes are included?

Have you tried erubis?

[http://www.kuwata-lab.com/erubis/](http://www.kuwata-lab.com/erubis/)

---

<div class="post-metadata">

**Author:** ![freddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://www.ruby-forum.com/u/freddy)\
**Post date:** [December 19, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804/5 "2006-12-19T14:21:57Z")

</div>

Sam Kapadia wrote:

> Have you tried erubis?
> 
> [http://www.kuwata-lab.com/erubis/](http://www.kuwata-lab.com/erubis/)

yeah,it is much faster,i have tested and it costs only half time of the  
original. But that means i have to change all the suffix of rhtml file  
into erubis, it seems that it erubis has not been accepted by most rails  
application’s deployment?

---

<div class="post-metadata">

**Author:** ![freddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://www.ruby-forum.com/u/freddy)\
**Post date:** [December 19, 2006, 2:43pm UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804/6 "2006-12-19T14:43:55Z")

</div>

Freddy wrote:

> Sam Kapadia wrote:
> 
> > Have you tried erubis?
> > 
> > [http://www.kuwata-lab.com/erubis/](http://www.kuwata-lab.com/erubis/)
> 
> yeah,it is much faster,i have tested and it costs only half time of the  
> original. But that means i have to change all the suffix of rhtml file  
> into erubis, it seems that it erubis has not been accepted by most rails  
> application’s deployment?

Nope its not accepted AFAIK. But if everyone here uses it … it will be  
accepted. Thats how open source project works. If speed is a concern  
then you outta go with Eurubis. And its not that big of change and it  
has a nice caching mechanism and it started to get popularity i.e.  
various blogs etc…

---

<div class="post-metadata">

**Author:** ![freddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://www.ruby-forum.com/u/freddy)\
**Post date:** [December 19, 2006, 10:08pm UTC](https://www.ruby-forum.com/t/improve-the-rendering-speed-of-rhtml/79804/7 "2006-12-19T22:08:25Z")

</div>

Freddy,

How long are the rendering times you’re seeing? If your app was  
performing ok, and you had to look at numbers in the log files to see  
a problem, is there really a problem?

Pete Y.
