Not so lately I read an article about compacting library files into one big
file and with opcode cache it gave 22 times faster aplication load.
Article is in russian, so thouse who can read it be my guest:
http://dklab.ru/chicken/nablas/49.html
For others I will make a quick summary.

What was taken: PHP, eAccelerator & Zend Framework.

First testing case:
He took full Zend Framework package and did next thing

function __autoload($className) {
    $fname = str_replace('_', '/', $className) . '.php';
    $result = require_once($fname);
    return $result;
}
// Include classes one by one
class_exists('Zend_Acl_Assert_Interface');
class_exists('Zend_Acl_Exception');
class_exists('Zend_Acl_Resource_Interface');
class_exists('Zend_Acl_Resource');
// and other 790 files like this
Totals:
Without eAccelerator: 911 ms
With eAccelerator: 435 ms

Now he made one big file 4.9 MB in size and included it with one
require_once call:
without eAccelerator: 458 ms
with eAccelerator: 42 ms

So we got a realy big performance boost. Although it is a little
sintetic, but in reality any big enought project will end up in
loading ~40-50 files in megabytes of code. Concatenating thouse
libraries in one file can give very big boost. And rememver,
eAccelerator isn't the fastest opcode cacher - APC and XCache are even
faster.

So my point is that multiple namespaces per file should be allowed.
Also it would be good idea to allow non namespaced code too, because
sometimes you have a few super global tiny functions, with you need
everythere and putting them into namespace is bad idea. Let the people
decide if they want to make a mess or not, because they will find a
way to make a total mess anyway! Let programmers like myself to feel
free.

P.S. I don't understand the people complaining about one more
whitespace - just don't put it if you don't like it. As of me, I earn
enough money to spend 200-300$ on good 19" LCD. Or you will start to
get complains from people coding in command line in vim that they
can't code normaly because they have only 80 symbols per line!

Reply via email to