title: Rails erb vs gsub dynamic template performance
body: <p>In my project, I am using the ERB as template engine. We have one page which used ERB template and it's loaded within 5-7 seconds.</p>
  
  <p>The same page we changed it into dynamic template, the template values are stored in the database. </p>
  
  <p>sample template</p>
  
  <pre><code>    &lt;p&gt; {{name}} &lt;/p&gt;
      &lt;p&gt; {{address}} &lt;/p&gt;
      &lt;p&gt; {{mobile number}} &lt;/p&gt;
  </code></pre>
  
  <p>For applying the actual values over dynamic template, i have used the gsub. This case the same page takes load time as 16-20 seconds. I used 17 gsub over dynamic template.</p>
  
  <ol>
  <li>How erb rendering is fast? (Because i am using the same content
  before and after dynamic template) </li>
  <li>Is there any way to increase the performance?</li>
  </ol>
  
  <p>Note:
  Compared to 'gsub' method, 'sub' method is fast. But in my case i need to use global sub (gsub).</p>