Announcement

Collapse
No announcement yet.

SSI vs PHP includes benchmarks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SSI vs PHP includes benchmarks

    For the web developers among us, this might be interesting for you.

    We couldn't find any definitive benchmarks comparing the performance of SSI (Server-Side Includes) versus the use of PHP includes on HTML pages. These methods are commonly used for generating a common header or footer (or menu) on every page of the site. Given the choice, you might wonder which method is faster?

    While in theory, it would seem that a SSI done directly on the server without the overhead of the PHP scripting engine would be more efficient, real-life benchmarks prove otherwise.

    The following were tested on an Apache server with PHP installed as a module (rather than a CGI).

    The SSI page utilized a #include file= command as opposed to a #include virtual= as it was deemed to be a more minimal operation for the task at hand (including a static HTML page) and theorized to be faster than an #include virtual command.

    The same web page was use for all 3 tests, but they were modified to utilize SSI, PHP include, and no includes (static HTML page) respectively.

    Each request was repeated 20 times and the average was taken.

    The SSI page took 0.524 seconds.
    The PHP include page took 0.371 seconds.
    The static HTML page took 0.368 seconds.

    From these measurements, it seems that SSI (using #include file) is significantly slower than using PHP includes. PHP includes is only mildly slower than a static HTML page, but these measurements can vary with larger or smaller files.

    Hope this is useful for somebody.
    Ray
    PassMark Software
Working...
X