Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Are you running an opcache like Zend Opcache, APC, XCache etc? 3 seconds is amazingly slow.


I meant raw page generation times. With caching it was much quicker of course. I assume the PHP benchmarks are also non-cached, else you're just benchmarking the caching method.


Yea, opcache "caches" the compiled PHP code. So the first "page generation" might take ages, because PHP has to load all the .php files and compile them. But an opcache will _keep_ the compiled versions around, so the next time you need to execute the .php files, it can skip the (very expensive) step of compiling them again.

This makes PHP much, much faster. The only time the files are recompiled are if you restart your webserver, or if you modify the .php files.

I'm not talking about static html generation, that's another thing all together.


Is an opcache still not included in stock PHP? That was on the cards years ago, as I recall.


It is if you're using version 5.5: http://www.php.net/manual/en/intro.opcache.php




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: