PHP / KL1
This test compares performance of PHP code executed by KLone and other well-known webservers. Also, a comparison is made between execution of the following sample PHP and KL1 scripts with the same functionality:
Test PHP CGI:
<?php foreach ($_ENV as $k => $v) { echo "$k = $v <br>"; } ?>and KL1 active page:
<%! extern char **environ; %><% for (char **ep = environ; *ep; ep++) io_printf(out, "%s <br>\n", *ep); %>
Connect Time
The time taken by client to connect to a server process is measured.
![[php_kl1_test_connect]](php_kl1_test_connect.png)
Since KLone is not optimised for PHP (it is executed as standard CGI), it is out-performed by execution of PHP code on other webservers. While the connect time remains constantly below 50 ms for other webservers, KLone's performance decays linearly. However, if the equivalent KL1 script is used instead of PHP, KLone performs with more than double the speed compared to Lighttpd.
Request Handling Time
The time required to handle client request and output server response is shown below.
![[php_kl1_test_request]](php_kl1_test_request.png)
KLone's PHP requests are handled more efficiently than Boa but less efficiently compared to Lighttpd (slightly poorer results are shown also in comparison with Apache2). However, the final results show KLone's full potential: if KL1 code is used instead of PHP, the request time remains constant around 25 ms, whereas Lighttpd suffers from a linear increase.
Total Time
The total time taken to serve client is illustrated.
![[php_kl1_test_total]](php_kl1_test_total.png)
The results are similar to those shown by previous measurements: KLone lacks optimisation for PHP execution, resulting in quite poor performance. However, by using embedded C code in active pages one can obtain optimal results.