Question

I heard that we can optimize the performance of scripting language code such as php by using code caching techniques and using persistent interpreters. I know what is code caching but no idea about persistent interpreters. can anyone give me a brief introduction or link ? thanks..

Était-ce utile?

La solution

Persistent interpreters are what you have when PHP (or Perl, or ruby, etc...) are embedded within a webserver process.

In a traditional old-school CGI system, your script's interpreter would have to fire up for every request, do its own startup routines, THEN load the script, parse/interpret it, execute it, etc... Embedding the interpreter in the webserver proper removes the need for that first bit of startup overhead, and you're down to basically only the overhead of loading/running the individual scripts.

That overhead can be further reduced by means of caches (e.g. PHP's APC), which reach into the interpreters guts and can store the parsed representation of the script. Now you're down to just a little bit of cache checking/retrieval overhead, and spend more time actually RUNNING the script, rather than on the open/read/interpret/validate/compile stages.

Autres conseils

To enhance performance you can use Persistent Connections: http://www.phpeveryday.com/articles/PDO-Improve-Performance-with-Persistent-Connection-P558.html

T*he true terminology is Persistent Connection and not Persistent Interpreter because PHP is alreay per-compiled as by its name PHP: Hypertext Preprocessor*

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top