Google Search diml.org
[ french ]

Table des matières
1. How DIML Benches Were Proceeded
1.1 Perl Implementation Test Conditions
1.2 Php Implementation Test Condition
2. DIML Benches Execution
3. Notes About Performances
3.1 Core Processor Performances
3.2 MySQL Access Performances (via ESSISql extension)
3.3 Discussion About Performances
 Latest News
 An application of the  WCT_NEWS  component
>> Top of page

Perl vs. PHP

1. How DIML Benches Were Proceeded

Bench DIML files are generated in the current directory where the DIML maine template resides. Directory containing DIML files that are to be under test should be enabled in writing. This may be harmfull respect to system security, thus such benches should be only performed on a development server, or while running a "still on test" Web server. This feature should be disabled on production servers.

1.1 Perl Implementation Test Conditions

Bench measurements rely on the Perl Time::HiRes module, which allows using the high resolution internal clock (through the POSIX 2 gettimeofday() function). This module is available under PPM (ActiveState Perl distribution) or CPAN repository. All the laps are rendered in hundreds of second unit.

1.2 Php Implementation Test Condition

Benche measurements rely on the availability of the gettimeofday() function, and will also depend on the underlying operating system implementation.

2. DIML Benches Execution

Bench files of the ESSI Engine express a set of intermediate laps calculation along the DIML page construction process. These files need the TIMEBENCH configuration option to be set. A ".bnc" file (resp. .pbnc on the Php version) is generated as follows :

ESSI Activation Benchmarking
ESSI Document : f:\wwwroot\diml\index_fr.dim
Total activation time : 0.44 secs
------------------------------
Phase 1 (init) :                      0.05 secs
Phase 2 (resources) :                 0 secs
Phase 3 (template extraction) :       0 secs
Phase 4 (conditional checks) :        0 secs
Phase 5 (precompilation of statics) : 0 secs
Phase 6 (main scan) :                 0.39 secs
Phase 7 (header reconstruct) :        0 secs
------------------------------
Feeder Invocation Cpu Time (last Invoke statement within Phase 6)
FEEDER 0 :                            0.05 secs
FEEDER 1 :                            0 secs

  • Phase 1

    Phase 1 opens extra output streams (log), and will load the extension modules.

  • Phase 2

    Phase 2 compiles environement variables and CGI inputs. Times are not significant for a GET method.

  • Phase 3

    Phase 3 collects all the declared templates in the document, and prepare them for future use.

  • Phase 4

    Phase 3 checks conditional structures.

  • Phase 5

    Phase 5 compiles the static templates that need to be evaluated before starting the main parsing.

  • Phase 6

    Phase 6 compiles main sequence. Laps will integrate all periods used within an overscript scope (user invocations).

  • Phase 7

    Phase 7 finalizes the document, and constructs back the main header.

Next to these measurements will be given the individual laps of every overscript.

3. Notes About Performances

3.1 Core Processor Performances

Very unexpectedly, running a Perl implementation of the DIML processor on an Apache 2.0 with ActiveState Perl external engine is almost 4 times faster than the PHP4 version running the quite same code. The following benches attest of the difference* :

Perl Implementation

ESSI Activation Benchmarking
ESSI Document : f:\wwwroot\diml\support\dimltest_short.dim
Total activation time : 0.16 secs
------------------------------
Phase 1 (init) :                      0.05 secs
Phase 2 (resources) :                 0 secs
Phase 3 (template extraction) :       0 secs
Phase 4 (conditional checks) :        0.06 secs
Phase 5 (precompilation of statics) : 0 secs
Phase 6 (main scan) :                 0.05 secs
Phase 7 (header reconstruct) :        0 secs
------------------------------
Feeder Invocation Cpu Time (last Invoke statement within Phase 6)
FEEDER 0 :                            0 secs
Php4 Implementation

ESSI Activation Benchmarking
ESSI Document : f:/wwwroot/diml/support/dimltest_short.pdim
Total elapsed time : 0.68 secs
-------------------------------
Phase 1 (init) :                      0.05 secs
Phase 2 (resources) :                 0.01 secs
Phase 3 (template extraction) :       0.00 secs
Phase 4 (conditional checks) :        0.02 secs
Phase 5 (precompilation of statics) : 0.00 secs
Phase 6 (main scan) :                 0.59 secs
Phase 7 (header reconstruct) :        0.00 secs
-------------------------------
Feeder Invocation Time (within phase 6)
FEEDER 0 :                             0.01 secs

(*) Running configuration : Processor - Pentium 1.2 GHz / 128 M RAM, OS : Windows Millenium

3.2 MySQL Access Performances (via ESSISql extension)

Here again, comparing the PHP4 mysql library and Perl implementation using DBI::DBD results in a unargueable victory of Perl, in pure processing speed (we didn't talk about resources, did we ?). Perl is still much faster than Php4, and this was done using exactly the same algorithm.

The testing file executes a burst of 16 full selects in a 10 x 10 table, one colomn acting as an integer primary key, and 9 columns containing a 28 characters text pattern.

Perl Implementation

ESSI Activation Benchmarking
ESSI Document : f:\wwwroot\diml\support\sqltest_short.dim
Total activation time : 0.33 secs
------------------------------
Phase 1 (init) :                      0.06 secs
Phase 2 (resources) :                 0 secs
Phase 3 (template extraction) :       0 secs
Phase 4 (conditional checks) :        0 secs
Phase 5 (precompilation of statics) : 0 secs
Phase 6 (main scan) :                 0.27 secs
Phase 7 (header reconstruct) :        0 secs
------------------------------
Feeder Invocation Cpu Time (Invoke statement within Phase 6)
Php4 Implementation

ESSI Activation Benchmarking
ESSI Document : f:/wwwroot//diml/support/sqltest_short.pdim
Total elapsed time : 1.09 secs
-------------------------------
Phase 1 (init) :                      0.05 secs
Phase 2 (resources) :                 0.01 secs
Phase 3 (template extraction) :       0.00 secs
Phase 4 (conditional checks) :        0.00 secs
Phase 5 (precompilation of statics) : 0.00 secs
Phase 6 (main scan) :                 1.03 secs
Phase 7 (header reconstruct) :        0.00 secs
-------------------------------
Feeder Invocation Time (within phase 6)

3.3 Discussion About Performances

Performances were measured on quasi similar algorithms, according to some portability transcodings. The PHP processor was deduced, almost line by line from the Perl version. Other optimisations are expected, probably developped in deep C language, and served to both universes as a module API. That would take off both motor perfomances.


All material is copyleft V.G. FREMAUX (EISTI France) 1999 to 2003 except explicitly mentioned