Toon posts:

[perl/php] Voorgecompileerd?

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik ga binnenkort beginnen aan een artikel over verschillen/voordelen/nadelen van perl en php. Nu zijn er nog twee dingen die me onduidelijk zijn:

Ik heb gelezen dat voordat een php script uitgevoerd wordt het eerste gecompileerd wordt om de snelheid te verhogen. Nu heb ik hier wat mee gespeeld, het viel me op dat de eerste keer dat je een php script uitvoert hij trager is dan de keren daarna. Nu trek ik de conclusie dat hij de gecompileerde versie ook cached (in het geheugen neem ik aan). Maar klopt dat ook? Weet iemand hier wat van?

En ten tweede, dezelfde vraag over perl. Wordt dat nou echt regel voor regel geinterpreteerd (moeilijk woord :+ ) of ook van te voren gecompileerd. Zo ja, dan zal het gecompileerde programma waarschijnlijk niet gecached worden (CGI versie/gewoon bij shell scripting) neem ik aan. Maar hoe zit dat als je mod_perl gebruikt?

Ik heb hier geen informatie over kunnen vinden. En ik hoop dat jullie de antwoorden weten. :)

Verwijderd

Topicstarter
Na wat doorzetten heb ik 1 vraag al gedeeltelijk beantwoord:
Perl is also a middle language. Blocks of perl are compiled as needed, but the executable image is held in memory instead of written to a file. The compilation only happens once for any block of the perl script. The advantages of Perl's design make all this optimization work worth while. Perl maintains the portability of an interpreted language while achieving nearly the speed of a compiled language. Perl, nearly a decade old, with hundreds of thousands of developers, and now in its fifth incarnation, runs lean and fast. There is some amount of startup latency, as the script is initially compiled, but this is typically small relative to the overall performance of the script. In addition, techniques such as "fast CGI", which keeps the image of a frequently accessed CGI script in memory for repetitive re-execution, avoids this startup latency, except on the very first execution of a script.
Maar hoe zit dat met mod_perl?

Verwijderd

Topicstarter
Ik ben weer lekker bezig, zit ik m'n eigen vragen te beantwoorden. Ik had toch ietsjes beter moeten zoeken :+ Maar goed hoewel ik de belangrijkste vragen zelf al beantwoord heb, post ik toch ook even het antwoord op de mod_perl vraag wie weet vraagt iemand anders zich ooit hetzelfde af ;)
mod_perl mode

mod_perl mode is when Tallyman is running under Apache and mod_perl. Tallyman has been designed principally with this mode in mind, for several reasons. It is anticipated that most serious ecommerce implementations will use this mode.

Advantages:

1. Performance
1.1. compiled script caching

mod_perl compiles each perl script once, and then caches the compiled version in memory. This means that the script doesn't have to be compiled every time, which can result in huge performance boosts.
Ja dus, de scripts worden gecached :)

/me *schaam* *schaam* :o

  • ACM
  • Registratie: Januari 2000
  • Niet online

ACM

Software Architect

Werkt hier

In principe wordt elk script gecompileerd naar cpu-instructies.

Bij perl, php, python etc.
Bij mod_php wordt het standaard niet gecached (moet je de zendmodule, apc-cache, etc gebruiken)
Bij mod_perl wordt dat juist wel gedaan, misschien wel omdat de perl-engine "starten" wat zwaarder is, waarom daar wel en bij php niet, weet ik niet.