tags:

views:

104

answers:

8

I have created my own framework for my websites and it is around 410 KB. What should be the best framework size and does code size really matters? If there are some functions which are not being utilized on a page removing them will make any difference in page loading?

+4  A: 

First of all there is nothing best until it meets your requirements. The size depends on functionality. If you add more features to your framework, the size will grow. Comparing various php frameworks, you will notice the difference in size.

Lesser the foot-print, the better until it meets your requirements.

As for your later part of the question, here are some resources to browse through for general optimization though:

Sarfraz
+1 for mentioning useful links. I would love to know the best tools for PHP benchmarking esp if it does not require extra coding :)
jason
+4  A: 

The size of your files isn't at all indicative of the performance of the code contained within those files, just as the shortest algorithm is not necessarily the most efficient.

Benchmark your code. If you find that it is too slow, being profiling specific parts and find which areas are responsible for the most CPU time, and focus on optimizing those areas.

Alternatively, focus on building good caching capabilities into your framework. Being able to cache the output of your framework will far outweigh any potential optimizations you can make.

meagar
Are you suggesting me opcode caching? What do you mean cache the output of your framework? Is it possible to profile individual classes?
jason
A: 

I don't think so , because the powerful web servers and faster connection speeds it want matter

Sudantha
This answer doesn't make sense. It's like saying adding more weight to someone's backpack won't make them run slower because they're strong. It will still have an effect, just maybe not a noticeable one.
Jamie Wong
A: 

There is no such thing as a "best framework size". Frameworks include functionality which framework developers think is best fitted to a certain task, which the specific framework was designed for. If that task is more extensive, the framework will (most likely) be larger, if it is only a small task, the framework will probably be smaller.

Also, as it has already been said here, the size of the framework is only indirectly related to its peformance. Of course, in a larger framework it is more likely that there is code which is not performing very well, however, if a very small framework is very poorly coded, it will be much slower than a large framework with great code.

x3ro
+2  A: 

What are you expecting for an answer to "what is the best size?" Exactly 487 KB?

This is serverside, so the sheer size of the framework doesn't affect the end user in the same way it does for Javascript frameworks.

So keep your framework of a reasonable size and provide all the functionality you feel is integral to what you're doing.

I agree with meagar: benchmark if you want to see the effect of size of load times.

Jamie Wong
A: 

The median PHP framework size is 12676 KB.
http://matrix.include-once.org/framework/simple

mario
Hang on - none of those frameworks are listed as 12676 KB. Are you sure you mean 'median'?
Bobby Jack
You're not telling me the right translation for average is just 'average'? :|
mario
+2  A: 

The best size is as big as necessary and as small as possible.

Michael Borgwardt
+1  A: 

Code Size does not indicate anything. Some frameworks have more functionality than others, so they likely have more Lines Of Code and thus a bigger filesize. However, you can calculate several Code Metrics from source code that can give you an indicator how well your code fares.

Head over to phpqatools.org and go through the slides and tools for an idea of what is possible. If you are interested about framework software metrics, check out http://www.php-frameworks.net/

As for the performance part of your question, the answer is likely yes. The more you include that isnt needed, the slower your site will be. However, like almost everyone already suggested, you should benchmark to have real numbers.

Gordon