anon
anon

Reputation:

Web Speed: it's worth it to put every included file in only one?

I am doing some tests (lamp):

Basically I have 2 version of my custom framework.

Using my lite version more and more i am seeing a time decrease for the load time. ie, from 0.01 of the normal to 0.005 of the lite version.

Let's consider just the "include" part. I always thought PHP would store the included .php files in memory so the file system doesn't have to retrieve them at every request.

Do you think condensing every classes/functions in one big file it's worth the "chaos" ? Or there is a setting to tell PHP to store in memory the require php files?

Thanks

(php5.3.x, apache2.x, debian 6 on a dedicated server)

Upvotes: 0

Views: 145

Answers (2)

Pockata
Pockata

Reputation: 1578

Or you can do this:

  1. Leave the code as it is (located in many different files)
  2. Combine them in one file when you are ready to upload it to the production server

Here's what i use:

cat js/* > all.js
yuicompressor all.js -o all.min.js

First i combine them into a single file and then i minify them with the yui compressor.

Upvotes: 1

Byron Whitlock
Byron Whitlock

Reputation: 53851

Don't cripple your development by mushing everything up in one file.

A speed up of 5ms is nothing compared to the pain you will feel maintaining such a beast.

To put it another way, a single incorrect index in your database can give you orders of magnitude more slowdown.

Your page would load faster using the "normal" version and omitting one 2kb image.

Don't do it, really just don't.

Upvotes: 2

Related Questions