Packed version

I do not know if this is the correct place to post this, but come on.

I was reading the source code of the framework and saw that much comment. This is great for the developer and those who will develop over the framework, but it is terrible for the PHP interpret, there is much loss of time. I made a small script (below) to remove the comments of the files in the folder framework and did some tests. Just making the comments, cut up 1MB of files (about 21%). Then I put on my server and sent to do comparative tests for 30 seconds with 10 concurrencies. The "packed" makes 25% more requests in the same period.

That is, it would be interesting to keep what is today and create an extra version to be used on production servers, so the code runs faster. Production servers in the comments is unnecessary, as they are not read. The information the author, number of package, version, license, etc. could be placed in a single file in the root of the framework.

Code of script:

<?php





function search($path = null) {


	if ($path === null) {


		return null;


	}





	$files = glob("$path*.php", GLOB_BRACE);


	$dirs = glob("$path*", GLOB_ONLYDIR);





	foreach ($dirs as $dir) {


		if (!preg_match("!(^|.+/)(.svn)$!", $dir)) {


			$files = array_merge($files, search($dir . DIRECTORY_SEPARATOR));


		}


	}


	return $files;


}





$files = search(dirname(__FILE__) . '/framework/');





$cleanTypes = array(T_COMMENT, T_DOC_COMMENT);


foreach ($files as $file) {


	$tokens = token_get_all(file_get_contents($file));


	$fileClean = '';


	foreach ($tokens as $token) {


		if (!is_array($token)) {


			$fileClean .= $token;


		} elseif (!in_array($token[0], $cleanTypes)) {


			$fileClean .= $token[1];


		}


	}


	file_put_contents($file, $fileClean);


}





?>

PS: This is a simple and stupid script. It would be interesting to withdraw several new lines, double spaces or tabs, debug messages, etc… If you like, you can help create the script.

For production use, you can use yiilite.php instead of yii.php

I read in docs that is not indicated yiilite for those who do not use APC, right?

Incidentally, it would be interesting to do tests with the APC / yiilite without the comments too.