Prakash
Prakash

Reputation: 171

Splitting one file into multiple files, how it will affect on performance of site?

Lets say I have index.php file, in which I have following included files

contain of file index.php
---------------------------
include('header.php');
include('footer.php');
---------------------------

contain of header.php
---------------------------
include('cssfiles.php');
include('manu.php');
---------------------------

What is the performance of index.php file with above structure v/s only one file that contains whole code ? If anyone have any link related to this, can also suggest it.

Upvotes: 1

Views: 120

Answers (1)

John Bell
John Bell

Reputation: 2350

Generally for this type of code management, the differences in load times are so miniscule, that the benefits of using such a system outweighs the performance load. I would encourage anyone to look into MVC models for better code management.

The only way you'd see a performance spike is if you had hundreds of files, and then I'd implore you to look at __autoload(). But From what you've posted there, it looks like a fairly standard and common practice for PHP developers.

You can read this for a bit of clarity if you still need more information.

Upvotes: 1

Related Questions