OOPS, is the performance going?

I worked on my site written in php / mysql. When I first wrote it, it was spaghetti with lots of php built into html, etc. - very difficult to maintain.

I rewrote it all with a good modular structure with OOPS, and now it is much easier to maintain and extend.

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

During the boot process, the difference is almost 1 second - 2.39s versus 3.81s

Nothing else has been changed except php code, not js, not css

So what's the problem? Should I go back to the old code? Has this happened to others?

Edit:

  • I did some analysis using cachegrind, inclued, and I think the code is pretty good.
  • I also know that the problem is not completely OOPS, but a big structure, etc. and also that OOP does not guarantee better performance at all.
  • I also ran the code several times.
  • I used cachegrind with kcachegrind, inclued, siege (most of the tools of Rasmus lerdorf are outlined in his talk drupalcon 2008 on 'Simple Hard)

What I want to know is how others handle this.

+3
source share
7 answers

I can think of a few points:

  • OOP . , , . , ( C- OOP-ey.) . - .
  • . ( , PHP , , PHP ). , ( ) , . ? , , "" ?

, ( , ..), , )

+1

" ?"

, , : " , , OO , OO, ". .

, , : " ".

, ?

. . OO , . OO "" - . OO OO. , , .

, .

, "" - .

, - , . . (-, ..).

+14

. , PHP, , .

, . , , .

+6
There a difference of nearly 1 second in loading time - 2.39s vs 3.81s

3,81-2,39 = 1,42 , 50% , . , / ? , , , , ? , , , , .

+1

Xdebug , . - , . , Xdebug , . IDE- Xdebug.

+1

, : APC - PHP? , , . .

0

OOP means many function calls, and function calls in dynamic languages ​​are slow. Therefore, the "transfer" of old code to the OOP version will slow it down. Make a complete rewrite.

0
source

Source: https://habr.com/ru/post/1703509/


All Articles