GEkk
GEkk

Reputation: 1366

Will Rails Fragment Caching make any performance improvement for storing a SVG or complex html?

I have a big SVG file about 50kb, that I can't add as an external image or from the CSS (where the SVG will be cached as an ordinary image), so the SVG is inside the HTML document.

This SVG exists on a lot of pages and loaded a lot of times.

But I am not sure it will make any impact on the performance, as the SVG still will be sent to the user view every time, so there are no traffic savings, and the SVG does not perform any model, database requests or partial rendering.

The question: Is it make any sense to cache such fragment? and if yes why?

Example:

  <html>
    <head>
      ...
    </head>

    <body>
      <div class="container">
        <svg ...>
          ... # => a lot of SVG code that can be cached
        </svg>
      </div>
    </body>

    <footer>
      ...
    </footer>
  </html>

Upvotes: 0

Views: 199

Answers (0)

Related Questions