In this little tip, I will help you to cut Yii size for about half
yii-1.1.8.r3324 framework directory is 10.4 mb size.
Lets see what you can achieve by deleting some things we "don't need"
This will make the framework more portable, and will make the development process more fun by speeding the copy procedure etc.
First of all, I must say Yii framework not so bloated as Zend Framework for example, where there is really a lot of things you will never use, like barcode etc. In Yii, You need most of the stuff...
So lets go directory by directory, end delete some stuff!
framework/cache/
There you have some caching classes, feel free to delete what you don't use I deleted CEAcceleratorCache.php, CWinCache.php 8kb saved... but it's not the end ;-)
framework/i18n/data
3.71mb of data that you will never use!
just find the english, and some languages you use and delete all the other stuff...
I deleted all except of en,ru,he
250kb left, 3.46mb deleted
framework/messages
1.15mb of stuff you will never use
just pick the langueages you use, and delete the others
deleted all except en,ru
80kb left, 1.07mb saved
framework/test
This is a good idea to test your code... But I'm sure most of you don't do it... so fill free to delete it
-20kb ;-)
framework/views
300kb of views you don't need...
just choose your language... chose ru,en...
40kb left 260kb saved
up to now by directories comparison I shrinked the library from 10.4mb to 5.59mb
In .rar form it is 3.204mb vs 1.54mb
Another benefit from it is that if you use some IDE, sometimes it can drive you crazy as it indexing sometimes so slow... So the less files you have... the faster indexing and projects refresh you have... So this is another nice benefit...
Fill free to shrink it even more ;-)
Total 11 comments
I was looking for it. Cause I hate spend space in HD with not utility things. Nowadays, this folder "framework" has 19.4MB with these simple clear this folder has 6.1MB.
Thanks for this explanation.
Will less than 5mb really make a difference?
Maybe the IDE indexing is a bit slow (it was always fast to me), but it's done only once, unless you have a copy of the framework directory in every project of yours.
You can also delete those schema files of other database that you don't use. They are located under db > schema
The cache and test stuff, don't really weight much. But this stuff:
1. ramework/i18n/data
2. framework/messages
3. framework/views
Really most of it *useless, and you don't hurt the framework.
Files you do not include are not even accessed nor readed, file you include - you need them :) This is the way server works. Also opcode cache will process only files you realy include and use.
Maybe refreshing project in IDE will be slightly faster, but this is difference I would ignore since you don't do that every minute. But if you like to have total order and delete every file you don't need - your choice, I won't fight for it :)
I don't sure how much this improve performance... But actually the less files you have - the includes should work faster... And the internalization directories really bloated... So you can actually gain some performance. To delete the stuff you don't need takes about 1 minute, ones a year this is something that every one can do - not a big deal at all.
This is also good for the fastness of the IDE, especially with indexing with Zend Studio for example... Actually you can just put the internalization in ignore... but here you really will do it every project... so better just delete it.
I have couple of servers running Yii, everyone of them needs only single installation of Yii in common search path... same on my development machine - single Yii instance for all projects. so I don't find it useful to save 2-3mb of disk and remember to repeat this after every framework update.
The files add up to less than a couple mp3s or 1 large image. Hardly seems worth it since the files don't slow anything down and you have to repeat everything the next time an update is released.
When I started reading, I was like:"WTF whats this guy thinking!!! deleting parts of my precious yiiii????"
But now I must say, these are really good tips, most of the files you mention specially i18n and messages are most likely never used, not everyone needs/develops multilingual apps.
But instead of deleting the test/ folder I would say: TEST TEST TEST YOUR APPS!!! :D
This is not about minimizing the existings stuff... This is about deleting stuff you will never use...
Yii comes with zillion translations, and after you delete it , the size shrinks for about half...
And this is without effect it's functionality.
Handling updates is very easy - just do the procedure again...
You can write a script for this... but why? it takes a few minutes, and Yii don't change versions every other day
Never occurred to me that you could do that. I'm mostly looking at which files APC is holding in its file cache, which is already at its bare minimum thanks to Yii's "loaded when needed" dogma. Are you running a script to delete those files? Or how else are you handling framework updates? Have you dared to minimize
framework/dbyet?Leave a comment
Please login to leave your comment.