The comparative test of efficiency of programming languages for WEB
To compare always interestingly and difficultly simultaneously - it is especial in a case when compared systems carry out identical functions, but do{make} it differently.
Modern webs - applications become more and more refined and are more and more overloaded with complex logic. Earlier productivity of such applications was defined{determined}, basically, speed of job of this or that sql-server and that, whether exists for him effective enough realization of the driver of access to the sql-server for the chosen programming language. It speaks that, that the first generation of webs - applications simply read and wrote the information to databases. Users thus was slightly. Thus, time for working off of sql-search made 70 … 90 % from general{common} time of processing of http-search.
With increase of requirements to scalability (increase in quantity{amount} of users) and escalating of logic of the application of the requirement to the programming language and the environment of performance essentially grow. To this it is necessary to add also, that be relative recently webs - applications went from the world the Internet in the world of corporate applications. It has again raised{increased} requirements to efficiency of the environment of performance.
At present time for creation of webs - applications exists set of various programming languages. Most popular of them - php, perl, With * (dot.net), java2. The classical technology asp becomes a history, as asp dot.net practically vytisnilo this technology on windows-servers in new applications.
The reason of occurrence of this clause{article} was desire to receive performance about efficiency of these programming languages be relative each other. Having looked it is a little, I have not found on this subject anything interesting and have decided to write small tests independently.
There is a huge quantity{amount} of the tests comparing productivity of webs - applications, realized with the help asp dot.net with java2 technologies. These tests are complex enough - as a rule, this classical " pet shop " the application (or his analogue), realized in two variants. The parity{ratio} of productivity in these cases is defined{determined} as the attitude{relation} of time of reaction of the application on http-search at identical number of searches in a second. The parity{ratio} at stressful loading thus usually makes 2/3 for the benefit of dot.net. First of all, it speaks more effective realization of the dot.net-machine and very close integration with the mssql-server. Thus such applications do not differ a plenty of business - logic.
And comparisons with modern skriptovymi languages, such as perl and php, I and at all have not found.
For finding-out of potential of programming languages has been solved to write simple tests as console applications. The purpose of this application - emulation of a plenty business of logic, that is cycles and conditional transitions. Further in the test it has been added konkatenacija lines, as this one of the most often meeting operations in business - logic of webs - applications. The test is synthetic, but I and did not set as to myself the purpose reception of a real picture at job of the average application. The purpose was reception of some extreme conditions, more likely. Conclusions do{make}. The only thing that is possible to say in a consolation to fans{amateurs} skriptovykh languages, it that interaction with databases at them is realized by means of native-drivers that substantially increases speed of job in the bottleneck of any web - application. For myself I have made the conclusion that I shall not begin to use them for creation something responsible{crucial}.
The problem of business - logic of the test is a presence{finding} of first hundred simple numbers. (I Shall remind, that the simple number is such number which can be received only by multiplication of the to unit.) it is natural, if in the real application there was a similar problem it would be more expedient, najdja these numbers once, simply to write down their kind of a file from 100 numbers. Unfortunately, in a real life not all problems{tasks} can be solved preliminary. Results of a conclusion of the program were redirected to a text file that has allowed to optimize substantially losses at a conclusion of the text to the console. Though the program deduces only hundred lines, the difference turns out appreciable enough. The initial code of a java-variant of the application is below resulted. He is simple enough and does not require additional explanatories:
import java.text. *;
import java.util. *;
public class test {
public static void main (string [] args) {
int maxprimes = 100;
int value = 1;
int count = 0;
stringbuffer sb = new stringbuffer ();
long start = system.currenttimemillis ();
system.out.println (" printing the first " + maxprimes +
" numbers that are prime … n ");
while (count <maxprimes) {
value ++;
int composite = 0; // false
for (int i = 2; i <value; i ++) {
for (int j = i; j <value; j ++) {
sb.append ("a");
if ((j * i) == value) {
composite = 1; // true
break;
}
}
if (composite == 1) {
break;
}
}
if (composite == 0) {
count ++;
system.out.println (value + " is prime ");
}
}
long time = (system.currenttimemillis () - start);
system.out.println ("took" + time + "mseconds.");
long len = sb.length ();
system.out.println (" string length " + len + "symbols.");
}
} // end of class
If it is necessary to receive the test without konkatenacii lines - simply zakommentirujte a line of a code:
// sb.append ("a");
All other realizations of the test in other programming languages are absolutely identical.
Results of tests for productivity are resulted below.
Platform - linux redhat 9 (celeron 1700) under vmware.
Language - perl.
Logic: 6 seconds;
Logic + konkatenacija lines: the interpreter has not coped with performance of the test. The test was carried out more than ten minutes. To me has bothered to wait, and I have stopped his performance.
Platform - linux redhat 9 (Seleron 1700) under vmware.
Language - php4.2.2
Logic: 15 seconds;
Logic + konkatenacija lines: the test is not executed with a mistake of the interpreter - " the timeout of 30 seconds is exceeded - performance is interrupted ".
Platform - linux redhat 9 (Seleron 1700) under vmware.
Language - java2 (jvm sun 1.4.2).
Logic: 0,657 seconds;
Logic + konkatenacija lines: 3,680 seconds.
Platform - windows 2000 sp.4 (Seleron 1700).
Language - perl (active perl).
Logic: 4 seconds;
Logic + konkatenacija lines: 7 seconds.
Platform - windows 2000 sp.4 (Seleron 1700).
Language - With * (dot.net 1.1).
Logic: 0,030 seconds;
Logic + konkatenacija lines: 0,721 seconds.
Platform - windows 2000 sp.4 (Seleron 1700).
Language - java2 (jvm sun 1.4.2).
Logic: 0,070 seconds;
Logic + konkatenacija lines: 1,422 seconds.
It is necessary to note that, despite of significant backlog, realization active perl for windows nevertheless has not bad enough proved to be - she is deserved it is considered one of the best realizations of this programming language.

|