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

  • Home
  • SEARCH
  • 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 135271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:45:48+00:00 2026-05-11T06:45:48+00:00

I was working on my website written in php/mysql. When I first wrote it,

  • 0

I was working on my website written in php/mysql. When I first wrote it, it was spaghetti with lots of php embedded in html and the like – very hard to maintain.

I rewrote the whole thing with a nice modular structure with OOPS, and now it is much easier to maintain and expand.

But when testing the site performance using webwait and siege, the newer, better structured version seems to run and load slower than the spaghetti code version.

There’s a difference of nearly 1 second in loading time – 2.39s vs 3.81s

Nothing else was changed except the php code – not the js, not the css

So what is the problem here? Should I revert back to the old code? Has this happened to others?

Edit:

  • I have done some analysis using cachegrind, inclued and I think the code is pretty good.
  • I also know that the problem is not entirely OOPS but the greater structure etc. and also that OOP doesn’t at all guarantee better performance.
  • I have run the code multiple times too.
  • I’ve used cachegrind with kcachegrind, inclued, siege (most of the tools Rasmus lerdorf outlined in his drupalcon 2008 talk on ‘Simple is Hard’)

What I want to know is how others deal with this.

  • 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. 2026-05-11T06:45:49+00:00Added an answer on May 11, 2026 at 6:45 am

    I can think of a couple of points to consider:

    • It’s not a choice of OOP vs spaghetti code. There are other paradigms that may be just as maintainable and structured as OOP, but with different performance characteristics. It is possible to write OOP code using only simple procedural language features (many big C frameworks use a very OOP-ey style.) A more functional style may also be simpler in some cases. OOP isn’t the One True Paradigm.
    • There are different degrees of OOP. Modelling data as objects does not in most languages cause a noticeable performance difference (I don’t know how PHP performs in this area, though, but with PHP I always expect the worst). However, virtual functions, inheritance (and especially multiple inheritance) are slower and add overhead that often could have been avoided. Which OOP features do you use? Is there a simpler OOP design that would do the job, but with less reliance on ‘slow’ language features?

    On top of that, the usual obviously applies (can you optimize the algorithm, enable caching or precompilation, and so on – but while those may help dramatically, they’re not specific to OOP)

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

Sidebar

Ask A Question

Stats

  • Questions 93k
  • Answers 93k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Don't add the 'busy view' to the table view, add… May 11, 2026 at 6:43 pm
  • Editorial Team
    Editorial Team added an answer You could use a timer that you start on the… May 11, 2026 at 6:43 pm
  • Editorial Team
    Editorial Team added an answer what about var obj = $('#element'); var str = obj.text(); May 11, 2026 at 6:43 pm

Related Questions

My team is working on a crappy old website and most of the pages
Looking for some direction here as I'm running into some migration problems. We have
In few months I start a project in PHP and I am hesitating to
I implemented OpenID support for an ASP.Net 2.0 web application and everything seems to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.