Bump.
I want to discuss a certain aspect of my framework with anyone experienced in PHP.
The Article module is relatively simple compared to some of my other planned modules, and yet its execution time is starting to get up there. To view an article, 20 separate PHP files need to be loaded and parsed.
Here is a tree structure representing the files that are loaded, how long they took to load, and which files loaded them in the first place.
Code:
120ms: index.php
8ms: Control/framework.php
0ms: Control/config.php
1ms: MySQLiSession.php
0ms: framework language file: en-US
106ms: Article renderer
4ms: Article/Control/Scripts.php
3ms: Article language file: en-US
15ms: Article/Model/Article.php
0ms: Article/Control/config.php
5ms: DBRow.php
4ms: DBTreeRow.php
2ms: User/Model/User.php
0ms: User/Control/config.php
0ms: User language file: en-US
3ms: Article/Model/ArticleCategory.php
1ms: HTML.php
1ms: User/View/Templates.php
3ms: Article/View/Templates.php
4ms: Form.php
To put it in more readable english,
Code:
the initial view script (the page requested by the client browser) loads:
Greeble framework, which loads:
framework configuration
MySQL session handler
framework language file
Article renderer, which loads:
Article control scripts (a bunch of logic, input validation, etc), which loads
Article language file
Article Class Definition, which loads
Article configuration file
Database abstraction class
Database tree structure abstraction class
User class definition, which loads
User configuration file
User Language file
Article Category class definition
base HTML templating class
User templating class
Article templating class
Form templating class
Obviously, in this example, the article render script is the biggest timesuck by far. The files it depends on take a total of 36 milliseconds to execute (and that execution time is basically just the time it takes to compile, as all those files just contain class/function/constant definitions), so on its own it's spending 70 milliseconds doing its thing.
Keep in mind this is running on my windows machine with Firefox, AIM, iTunes, and Eclipse running in addition to Apache with PHP, which are all notorious memory hogs. It runs on average about twice as fast on my linux laptop, and considerably faster on my production server.
So, I dunno, I guess I'm asking what your impressions are of this.
My first impression is "gosh, Greeble's getting kind of bloated...
"
Bookmarks