Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8978851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:42:23+00:00 2026-06-15T19:42:23+00:00

Note: this question is a bit long I have a PHP-based system with Service-Dao-Model

  • 0

Note: this question is a bit long

I have a PHP-based system with Service-Dao-Model structure as follow:

Service Factory > Foo Service > Core Service > Abstract Service > Service Interface
Dao Factory > Foo Dao > Core Dao > Abstract Dao > Dao
Foo > Core Model > Abstract Model

Let me explain bit-by-bit. I try to centralize the codes first by define abstract functions in Abstract & Interface classes, then implement default behavior in Core Service, Core Dao and Core Model.

Then, the custom functions are written in Foo Service, Foo Dao and Foo Model. Last, Service Factory & Dao Factory is responsible to create object in Factory Pattern.

Other Information: all classes have log4php object attached in __construct().

In current development status, I loaded around 65 PHP classes in initialization phase. By adding timer (timed by microtime(true)), I found that PHP takes most time (0.02119s) on loading up the classes, next is converting DB result set to object values (0.00608s), last is DB query time (0.00223s). Can’t believe that class loading time is 10 times more than DB query time!

QUESTION: how to improve PHP initialization time on loading up classes?

Versions : PHP 5.2.16 , Connect to MySQL 5.1 localhost server via MySQLi PHP extension

UPDATE eAccelerator is pre-installed in shared hosting! Zend Engine v2.2.0 with eAccelerator v0.9.6.1

p.s. codes can be shared if needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:42:24+00:00Added an answer on June 15, 2026 at 7:42 pm

    I would assume you are using some kind of autoloading if the class loading times are so slow. Consider an approach similar to Symfony’s APC class loader:

    http://symfony.com/doc/current/components/class_loader.html
    https://github.com/symfony/ClassLoader

    The idea behind it is that it caches the classpaths in APC so the include path for autoloading is not traversed for every request. Anyways I think there is some architechtural issue if the actual php loading is slower than the DB, even more so if its slower than the ORM layer…From my experience loading times are the other way around usually. Which parts of the PHP are slowest in particular. Another approach you can use is also an idea from symfony, where you have a deploy script which upon deployment merges all classes in one file, reducing file system calls, but i dont know if thats going to even be practical in your case, its definitely a speed improvement. Basically every time you have a file system operation its dead slow, so avoid it as much as possible..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT NOTE I am rewording this question entirely now that I have a bit
Note, this question is a bit subtle so read it carefully: I'm not just
Note: This question has broadened in scope from previous revisions. I have tried to
This question is a bit long, please bear with me. In REST, i think
NOTE: This is a long question. I've explained all the 'basics' at the top
I have a query that looks a bit like this (note: the actual query
Please note that this question is intended to be a bit more on the
Note: this question has nothing to do with Knockout.js, but it's about the selectedOptions
Note this question was originally posted in 2009, before C++11 was ratified and before
Note: This question is related to an advice rather than an issue. I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.