Приглашаем посетить
Спорт (www.sport-data.ru)

The Right Language

Table of Contents
Previous Next

The Right Language

The first question a developer facing a performance issue should check is if they're using the right programming language. Perhaps the language interpreter causes most of the slow down, so there's little point in optimizing the code; it'll never be enough.

Several programming languages were benchmarked to check how fast they were compared to PHP. The benchmarks involved a lot of different types of scripts using different operations; the results are an average of all the tests.

The tests were done on:

After several benchmarks, including different script types and server loads, it was found that mod_perl, FastCGi, and PHP were the fastest options with very similar results. Therefore, if a PHP site or script is facing a performance problem then the solution is to work with the code and not change the language.

The Benchmarks

Test 1 – 1000 executions of a very short script:

Language

Time (seconds)

C

20.6

Perl

23.8

Python

45.2

PHP

16.0

mod_python

30.0

mod_perl

16.4

FastCGI

16.4

Test 2 – 1000 executions of a long script, more than 1000 lines of code:

Language

Time (seconds)

C

258

Perl

963

Python

978

PHP

304

mod_python

347

mod_perl

476

FastCGI

280


Table of Contents
Previous Next