ServerSide Speed Test
Recently, JavaScript engine performance tests have become very popular, but they mainly concern Client Side JavaScript. I was interested in the question: how are things going with Server Side? But testing only Google V8 and SpiderMonkey would be uninteresting. It is clear that the results will be similar to those of Client Side - the engines are the same. Therefore, it was necessary to add to the tests something that is not available in the browser, but it is quite common, and also try to use tests specific to server tasks. This missing test object was seen by the JScript compiler from the .Net Framework. However, the preliminary test results came as a surprise to me, and I decided to add a fourth player from the same team.
.
First of all, it should be said that I did not set the goal of 100% objectivity of the tests. The goal was to test engines that are accessible at arm's length (5 minutes of googling) and in the environment that is accessible to me. And this:
Windows XP SP3 on AMD Sempron 2800+ 1.6GHz 1Gb RAM
Windows 7 x64 on Intel Core i5 650 3.2GHz 4Gb RAM
Despite the simplicity of the tasks, obtaining the result lasted for several days.
A simple testing methodology was chosen. Each test is a certain function that is launched to execute in a loop a large number of times. The execution time of the entire cycle is measured. The average execution time of each iteration is taken as an evaluation criterion. I did not follow the principles of statistical reliability - run tests several times in a row and calculate the average deviations. This approach, in my opinion, requires a deeper analysis than just running the tests several times and calculating the average deviations.
In order to evaluate how much time the test itself takes in the test, the first test will be an empty function. In addition, in the light of recent trends that are associated with technology for removing dead code, I wanted to somehow take this factor into account in tests. It never occurred to me any better than setting the requirement for the tested functions to return a certain result, which is based on what a particular function does. Thus, the cunning optimization techniques, I hope, will not have a reason to throw the "necessary" code. Naturally, cunning optimization can throw out code on the basis that the result of the function is not used further. Therefore, I added an additional parameter to each tested function - a function for aggregating the results. The aggregated result itself will also be the result of the test. To assess the effect of aggregation itself on the result of the cycle, I ran it again without aggregation. It also helps to subjectively assess whether there is optimization for eliminating dead code.
For the convenience of running tests and processing the results, I wrote a small framework. In addition, for the uniform output of test results for each engine, its own adapter module was used. The results were formatted in html, displayed on the console, and accumulated in a single file through thread redirection.
To run the entire test, a small set of CMD files was used.
The first player is a promising and increasingly popular Google V8 engine that runs on Google Chrome, and is presented in the test in the form of no less promising NodeJS . I was sure that the test results would not disappoint me.
The second player is a fairly fast engine with a rich history - SpiderMonkey, which works in FireFox, in tests it worked on behalf of JSDB . Here I also did not hope for any significant differences from Client Side tests.
The third player is Microsoft's JavaScript compiler. I was wondering what benefit the use of the compiler gives compared to interpreters.
Fourth player - for a more complete comparison, it would be nice to use another interpreter from Microsoft.
In case of testing the interpreters, I simply merged all test files, the framework and adapters into one file with the copy command, fed the resulting file to the interpreter. For NodeJS it is nodejs.exe, for JSDB it is jsdb.exe, for the interpreter from Microsoft it is Windows Script Host represented by cscript.exe utility.
For the compiler, all files were fed by jsc.exe from the corresponding version of the .Net Framework and the resulting exe file was launched.
The recruitment of players on each platform was different.
Yes. I was not mistaken. Microsoft JScript 9.0.16406 is the very engine used in IE9. I had to do a little magic to make it work in Windows Script Host without installing IE9 itself. I don’t even know if it will be available in WSH after installation, since the library in the installation package is called differently and next to it lies the old engine from IE 8, with a normal name.
Under Windows 7, I still had access to the compiler from .NET v.2.0, but the test under it for some reason fell out with an error, details later.
I used different versions of the engines from Microsoft to see if there is any progress in speed from version to version and which one. They lay under my feet. Why not include them in the test?
Further for each test I will give the tested function and the results for the average cycle time for all engines. Then all test results at the end.
here func is the test function, reduce is the aggregator function, start is the start value of the aggregator, loops is the number of cycles in the test.
Empty test results on Windows XP (less is better) Empty test results on Windows 7 (less is better)
A test of a typical string operation.
String Concat Results on Windows XP (Less is Better) String Concat Results on Windows 7 (Less is Better)
In my opinion, a typical server operation.
Apply template results on Windows XP (less is better) Apply template results on Windows 7 (less is better) The following tests I took from Google V8 Benchmark Suite version 6 . Unfortunately, it turned out that these tests are full of errors. The errors were pointed out to me by the JScript compiler. Some errors were related to incomplete compatibility of JScript and JavaScript. Part really was a mistake. I took 3 tests that created the least problems. I adapted it a bit to my framework, fixed errors. One could take tests from Sunspider, but, unfortunately, I did not find them in the form of convenient js sources. The version presented on the site with the test requires processing by the parser, because it is built into html. I will not give here the sources of these tests - only the results.
As stated on the site, simulates the operation of the OS kernel.
V8 BS Results - Richards on Windows XP (Less is Better) V8 BS Results - Richards on Windows 7 (Less is Better)
Data encoding.
Results V8 BS - Encrypt on Windows XP (less is better) Results V8 BS - Encrypt on Windows 7 (less is better)
Decoding data.
V8 BS Results - Decrypt on Windows XP (Less is Better) V8 BS Results - Decrypt on Windows 7 (Less is Better)
Regular expressions extracted from 50 popular sites on the Internet.
Results of V8 BS - RegExp on Windows XP (less is better) Results of V8 BS - RegExp on Windows 7 (less is better) Complete table of results on Windows XP. NodeJS v 0.2.4
Microsoft .NET v.1.1.4322.2032
Microsoft .NET v.2.0.50727.3053
Microsoft .NET v.4.0.30319.1
JSDB 1.8.0.3
Microsoft JScript 5.6.8825
Microsoft JScript 5.7.16599
Microsoft JScript 5.8.18702
Complete results table on Windows 7.
NodeJS v 0.2.4
JSDB 1.8.0.3
Microsoft .NET v.4.0.30319.1
Microsoft .NET v.4.0.30319.1
Microsoft JScript 5.8.16475
Microsoft JScript 9.0.16406
The .NET compiler (more precisely, the results of its work) turned out to be the slowest. Either I'm doing something wrong, or he is just not good at anything. Interpreter from Microsoft versions less than 9th failed the test for the use of the template - the result is different from the rest. A closer examination showed that it differs in the assignment of the parameters of the callback function to replace.
Under Windows 7, it was not possible to test the compiler version from the .NET Framework 2.0, and version 4.0 behaved no less strange. The test worked for 20 minutes. Version 2.0 crashed with an error. For both versions, the test consumed up to 6 GB of memory. Why did the tests themselves show not such catastrophic times? A closer look at the problem revealed a strange feature of the compiler for Windows 7 x64: the V8 BS - Regexp test created the problems. Moreover, the compiled program began to devour memory even before the start of my code execution. It seems .Net somehow initializes regular expressions, which are abundant in this test, even before the code runs. Moreover, problems are observed if the regular expressions are in the function that creates the closure.
My final conclusion is this: the JScript compiler from the .NET Framework is good for nothing but testing the code for compilation errors. It also became interesting for me to test how C # will differ in such tasks. However, the “speedy” failure of JScript .NET begins to become clearer when you look at the stack trace when displaying error messages. I have not seen so many wrappers on simple calls.
However, the new interpreter from Microsoft JScript 9.0 is quite competitive, it is easy to extend its classes through ActiveScripting. Interesting is the choice of version. Why, after version 5.8, which was used in IE8, version 9.0 suddenly came out? However, after the official release, everything may change.
Leader in Google V8 shortness in NodeJS, but JScript 9.0 is on its heels. It seems to me that the final choice can be safely made not only by the criterion of speed, but by the sum of the factors. Including the convenience of expansion, debugging, integration with the platform.
And at the end - a meaningless, purely illustrative diagram. I just took the ratio of NodeJS time to the time of each test and averaged over the tests. Engine
rating (more is better) Links: NodeJS JSDB Google V8 Benchmark Suite version 6 Microsoft Windows Script Host Microsoft JScript
.
First of all, it should be said that I did not set the goal of 100% objectivity of the tests. The goal was to test engines that are accessible at arm's length (5 minutes of googling) and in the environment that is accessible to me. And this:
Windows XP SP3 on AMD Sempron 2800+ 1.6GHz 1Gb RAM
Windows 7 x64 on Intel Core i5 650 3.2GHz 4Gb RAM
Despite the simplicity of the tasks, obtaining the result lasted for several days.
Testing methodology
A simple testing methodology was chosen. Each test is a certain function that is launched to execute in a loop a large number of times. The execution time of the entire cycle is measured. The average execution time of each iteration is taken as an evaluation criterion. I did not follow the principles of statistical reliability - run tests several times in a row and calculate the average deviations. This approach, in my opinion, requires a deeper analysis than just running the tests several times and calculating the average deviations.
In order to evaluate how much time the test itself takes in the test, the first test will be an empty function. In addition, in the light of recent trends that are associated with technology for removing dead code, I wanted to somehow take this factor into account in tests. It never occurred to me any better than setting the requirement for the tested functions to return a certain result, which is based on what a particular function does. Thus, the cunning optimization techniques, I hope, will not have a reason to throw the "necessary" code. Naturally, cunning optimization can throw out code on the basis that the result of the function is not used further. Therefore, I added an additional parameter to each tested function - a function for aggregating the results. The aggregated result itself will also be the result of the test. To assess the effect of aggregation itself on the result of the cycle, I ran it again without aggregation. It also helps to subjectively assess whether there is optimization for eliminating dead code.
For the convenience of running tests and processing the results, I wrote a small framework. In addition, for the uniform output of test results for each engine, its own adapter module was used. The results were formatted in html, displayed on the console, and accumulated in a single file through thread redirection.
To run the entire test, a small set of CMD files was used.
Players
The first player is a promising and increasingly popular Google V8 engine that runs on Google Chrome, and is presented in the test in the form of no less promising NodeJS . I was sure that the test results would not disappoint me.
The second player is a fairly fast engine with a rich history - SpiderMonkey, which works in FireFox, in tests it worked on behalf of JSDB . Here I also did not hope for any significant differences from Client Side tests.
The third player is Microsoft's JavaScript compiler. I was wondering what benefit the use of the compiler gives compared to interpreters.
Fourth player - for a more complete comparison, it would be nice to use another interpreter from Microsoft.
In case of testing the interpreters, I simply merged all test files, the framework and adapters into one file with the copy command, fed the resulting file to the interpreter. For NodeJS it is nodejs.exe, for JSDB it is jsdb.exe, for the interpreter from Microsoft it is Windows Script Host represented by cscript.exe utility.
For the compiler, all files were fed by jsc.exe from the corresponding version of the .Net Framework and the resulting exe file was launched.
The recruitment of players on each platform was different.
Windows XP
- NodeJS v 0.2.4
- JSDB 1.8.0.3
- Microsoft JScript 5.6.8825 interpreter
- Microsoft JScript 5.7.16599
- Microsoft JScript 5.8.18702 interpreter
- JScript compiler from Microsoft .NET v.1.1.4322.2032
- JScript compiler from Microsoft .NET v.2.0.50727.3053
- JScript compiler from Microsoft .NET v.4.0.30319.1
Windows 7
- NodeJS v 0.2.4
- JSDB 1.8.0.3
- Microsoft JScript 5.8.16475 interpreter
- Microsoft JScript 9.0.16406
- JScript compiler from Microsoft .NET v.4.0.30319.1
Yes. I was not mistaken. Microsoft JScript 9.0.16406 is the very engine used in IE9. I had to do a little magic to make it work in Windows Script Host without installing IE9 itself. I don’t even know if it will be available in WSH after installation, since the library in the installation package is called differently and next to it lies the old engine from IE 8, with a normal name.
Under Windows 7, I still had access to the compiler from .NET v.2.0, but the test under it for some reason fell out with an error, details later.
I used different versions of the engines from Microsoft to see if there is any progress in speed from version to version and which one. They lay under my feet. Why not include them in the test?
Tests
Further for each test I will give the tested function and the results for the average cycle time for all engines. Then all test results at the end.
Empty function
tests.push({
name: 'Empty test',
func: function(){ return 1;},
reduce: function(r,x){ return r+x;},
start: 0,
loops: 1000000
});
* This source code was highlighted with Source Code Highlighter.
here func is the test function, reduce is the aggregator function, start is the start value of the aggregator, loops is the number of cycles in the test.
Empty test results on Windows XP (less is better) Empty test results on Windows 7 (less is better)
String concatenation
A test of a typical string operation.
var str1 = 'Hello ',
str2 = 'world ',
str3 = 'test ',
i = 0;
tests.push({
name: 'String Concat',
func: function(){
i++;
return str1+str2+str3+' '+i;
},
reduce: function(r,x){ return r+x.length;},
start: 0,
loops: 100000
});
* This source code was highlighted with Source Code Highlighter.
String Concat Results on Windows XP (Less is Better) String Concat Results on Windows 7 (Less is Better)
Filling a template with data
In my opinion, a typical server operation.
var template = '{title} {main}';
function ApplyTemplate(template, view){
return template.replace(/{(\w+)}/g,function(p,n){
if(n in view) return view[n];
else return '_ERROR_NO_VALUE_'+n;
});
}
var views = [
{
title:'Page One',
main: 'Lorem ipsum dolor sit amet, mauris libero velit, '+
'vitae pellentesque aliquam, cursus magnis velit, non '+
'viverra sed nibh ac fringilla vel, accumsan quis '+
'elementum fermentum ullamcorper. '+
/* ....тут много текста */
'lectus libero at etiam morbi, et orci eros ut sit et.'
},
{
title: 'Page two',
main: 'Short page'
}
];
var counter = 0;
tests.push({
name: 'Apply template',
func: function(){
counter++;
return ApplyTemplate(template, views[counter%2]);
},
reduce: function(r,x){ return r+x.length;},
start: 0,
loops: 10000
});
* This source code was highlighted with Source Code Highlighter.
Apply template results on Windows XP (less is better) Apply template results on Windows 7 (less is better) The following tests I took from Google V8 Benchmark Suite version 6 . Unfortunately, it turned out that these tests are full of errors. The errors were pointed out to me by the JScript compiler. Some errors were related to incomplete compatibility of JScript and JavaScript. Part really was a mistake. I took 3 tests that created the least problems. I adapted it a bit to my framework, fixed errors. One could take tests from Sunspider, but, unfortunately, I did not find them in the form of convenient js sources. The version presented on the site with the test requires processing by the parser, because it is built into html. I will not give here the sources of these tests - only the results.
V8 Benchmark Suite Richards
As stated on the site, simulates the operation of the OS kernel.
V8 BS Results - Richards on Windows XP (Less is Better) V8 BS Results - Richards on Windows 7 (Less is Better)
V8 Benchmark Suite Encrypt
Data encoding.
Results V8 BS - Encrypt on Windows XP (less is better) Results V8 BS - Encrypt on Windows 7 (less is better)
V8 Benchmark Suite Decrypt
Decoding data.
V8 BS Results - Decrypt on Windows XP (Less is Better) V8 BS Results - Decrypt on Windows 7 (Less is Better)
V8 Benchmark Suite RegExp
Regular expressions extracted from 50 popular sites on the Internet.
Results of V8 BS - RegExp on Windows XP (less is better) Results of V8 BS - RegExp on Windows 7 (less is better) Complete table of results on Windows XP. NodeJS v 0.2.4
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 21 | 0.000021 | 44 | 0.000044 | 1,000,000 |
String concat | 100,000 | 44 | 0.00044 | 47 | 0.00047 | 2288895 |
Apply template | 10,000 | 32 | 0.0032 | 28 | 0.0028 | 590000 |
V8 BS - Richards | 1000 | 4879 | 4.879 | 4702 | 4.702 | 0 |
V8 BS - Encrypt | 100 | 345 | 3.45 | 356 | 3.56 | 0 |
V8 BS - Decrypt | 100 | 7496 | 74.96 | 7514 | 75.14 | 0 |
V8 BS - Regexp | 100 | 11620 | 116.2 | 11913 | 119.13 | 0 |
Microsoft .NET v.1.1.4322.2032
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 1891 | 0.001891 | 4094 | 0.004094 | 1,000,000 |
String concat | 100,000 | 344 | 0.00344 | 859 | 0.00859 | 2288895 |
Apply template | 10,000 | 532 | 0.0532 | 609 | 0.0609 | 590000 |
V8 BS - Richards | 25 | 9266 | 370.64 | 9390 | 375.6 | 0 |
V8 BS - Encrypt | 10 | 2875 | 287.5 | 3062 | 306.2 | 0 |
V8 BS - Decrypt | 5 | 33657 | 6731.4 | 32078 | 6415.6 | 0 |
V8 BS - Regexp | 10 | 32296 | 3229.6 | 33219 | 3321.9 | 0 |
Microsoft .NET v.2.0.50727.3053
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 3328 | 0.003328 | 8578 | 0.008578 | 1,000,000 |
String concat | 100,000 | 515 | 0.00515 | 1297 | 0.01297 | 2288895 |
Apply template | 10,000 | 547 | 0.0547 | 657 | 0.0657 | 590000 |
V8 BS - Richards | 25 | 9703 | 388.12 | 9859 | 394.36 | 0 |
V8 BS - Encrypt | 10 | 2531 | 253.1 | 2875 | 287.5 | 0 |
V8 BS - Decrypt | 5 | 25344 | 5068.8 | 25047 | 5009.4 | 0 |
V8 BS - Regexp | 10 | 29032 | 2903.2 | 29234 | 2923.4 | 0 |
Microsoft .NET v.4.0.30319.1
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 2188 | 0.002188 | 5282 | 0.005282 | 1,000,000 |
String concat | 100,000 | 437 | 0.00437 | 1125 | 0.01125 | 2288895 |
Apply template | 10,000 | 500 | 0.05 | 610 | 0.061 | 590000 |
V8 BS - Richards | 25 | 9812 | 392.48 | 10031 | 401.24 | 0 |
V8 BS - Encrypt | 10 | 2719 | 271.9 | 3469 | 346.9 | 0 |
V8 BS - Decrypt | 5 | 28140 | 5628 | 28297 | 5659.4 | 0 |
V8 BS - Regexp | 10 | 34437 | 3443.7 | 33016 | 3301.6 | 0 |
JSDB 1.8.0.3
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 343 | 0.000343 | 719 | 0.000719 | 1,000,000 |
String concat | 100,000 | 703 | 0.00703 | 547 | 0.00547 | 2288895 |
Apply template | 10,000 | 383 | 0.0383 | 233 | 0.0233 | 590000 |
V8 BS - Richards | 1000 | 48319 | 48.319 | 49948 | 49.948 | 0 |
V8 BS - Encrypt | 10 | 905 | 90.5 | 925 | 92.5 | 0 |
V8 BS - Decrypt | 10 | 16571 | 1657.1 | 16475 | 1647.5 | 0 |
V8 BS - Regexp | 10 | 15968 | 1596.8 | 13636 | 1363.6 | 0 |
Microsoft JScript 5.6.8825
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 2578 | 0.002578 | 5812 | 0.005812 | 1,000,000 |
String concat | 100,000 | 4531 | 0.04531 | 4844 | 0.04844 | 2288895 |
Apply template | 10,000 | 1344 | 0.1344 | 1375 | 0.1375 | 410000 |
V8 BS - Richards | 100 | 18484 | 184.84 | 18422 | 184.22 | 0 |
V8 BS - Encrypt | 10 | 1813 | 181.3 | 1797 | 179.7 | 0 |
V8 BS - Decrypt | 10 | 32500 | 3250 | 32187 | 3218.7 | 0 |
V8 BS - Regexp | 10 | 37938 | 3793.8 | 37547 | 3754.7 | 0 |
Microsoft JScript 5.7.16599
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 4235 | 0.004235 | 6562 | 0.006562 | 1,000,000 |
String concat | 100,000 | 1625 | 0.01625 | 1969 | 0.01969 | 2288895 |
Apply template | 10,000 | 562 | 0.0562 | 594 | 0.0594 | 410000 |
V8 BS - Richards | 100 | 22328 | 223.28 | 22625 | 226.25 | 0 |
V8 BS - Encrypt | 10 | 1797 | 179.7 | 1813 | 181.3 | 0 |
V8 BS - Decrypt | 10 | 33953 | 3395.3 | 32219 | 3221.9 | 0 |
V8 BS - Regexp | 10 | 27813 | 2781.3 | 29609 | 2960.9 | 0 |
Microsoft JScript 5.8.18702
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 1171 | 0.001171 | 1532 | 0.001532 | 1,000,000 |
String concat | 100,000 | 844 | 0.00844 | 1235 | 0.01235 | 2288895 |
Apply template | 10,000 | 359 | 0.0359 | 359 | 0.0359 | 410000 |
V8 BS - Richards | 100 | 11906 | 119.06 | 12094 | 120.94 | 0 |
V8 BS - Encrypt | 10 | 1610 | 161 | 1578 | 157.8 | 0 |
V8 BS - Decrypt | 10 | 26875 | 2687.5 | 27281 | 2728.1 | 0 |
V8 BS - Regexp | 10 | 22781 | 2278.1 | 22391 | 2239.1 | 0 |
Complete results table on Windows 7.
NodeJS v 0.2.4
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 12 | 0.000012 | 14 | 0.000014 | 1,000,000 |
String concat | 100,000 | 17 | 0.00017 | thirteen | 0.00013 | 2288895 |
Apply template | 10,000 | 9 | 0.0009 | eleven | 0.0011 | 590000 |
V8 BS - Richards | 1000 | 1640 | 1.64 | 1749 | 1.749 | 0 |
V8 BS - Encrypt | 100 | 120 | 1.2 | 128 | 1.28 | 0 |
V8 BS - Decrypt | 100 | 2570 | 25.7 | 2573 | 25.73 | 0 |
V8 BS - Regexp | 100 | 3996 | 39.96 | 3996 | 39.96 | 0 |
JSDB 1.8.0.3
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 89 | 0.000089 | 221 | 0.000221 | 1,000,000 |
String concat | 100,000 | 177 | 0.00177 | 167 | 0.00167 | 2288895 |
Apply template | 10,000 | 33 | 0.0033 | 33 | 0.0033 | 590000 |
V8 BS - Richards | 1000 | 17738 | 17.738 | 17780 | 17.78 | 0 |
V8 BS - Encrypt | 10 | 272 | 27.2 | 276 | 27.6 | 0 |
V8 BS - Decrypt | 10 | 5095 | 509.5 | 5103 | 510.3 | 0 |
V8 BS - Regexp | 10 | 3454 | 345.4 | 3499 | 349.9 | 0 |
Microsoft .NET v.4.0.30319.1
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 574 | 0.000574 | 1344 | 0.001344 | 1,000,000 |
String concat | 100,000 | 149 | 0.00149 | 334 | 0.00334 | 2288895 |
Apply template | 10,000 | 140 | 0.014 | 281 | 0.0281 | 590000 |
V8 BS - Richards | 25 | 2268 | 90.72 | 2576 | 103.04 | 0 |
V8 BS - Encrypt | 10 | 471 | 47.1 | 2813 | 281.3 | 0 |
V8 BS - Decrypt | 5 | 4908 | 981.6 | 5018 | 1003.6 | 0 |
V8 BS - Regexp | 10 | 8762 | 876.2 | 8805 | 880.5 | 0 |
Microsoft .NET v.4.0.30319.1
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 516 | 0.000516 | 1293 | 0.001293 | 1,000,000 |
String concat | 100,000 | 118 | 0.00118 | 273 | 0.00273 | 2288895 |
Apply template | 10,000 | 136 | 0.0136 | 301 | 0.0301 | 590000 |
V8 BS - Richards | 25 | 2188 | 87.52 | 2477 | 99.08 | 0 |
V8 BS - Encrypt | 10 | 470 | 47 | 3000 | 300 | 0 |
V8 BS - Decrypt | 5 | 4831 | 966.2 | 5049 | 1009.8 | 0 |
V8 BS - Regexp | 10 | 8704 | 870.4 | 8826 | 882.6 | 0 |
Microsoft JScript 5.8.16475
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 244 | 0.000244 | 502 | 0.000502 | 1,000,000 |
String concat | 100,000 | 168 | 0.00168 | 224 | 0.00224 | 2288895 |
Apply template | 10,000 | 90 | 0.009 | 95 | 0.0095 | 410000 |
V8 BS - Richards | 100 | 4391 | 43.91 | 4400 | 44 | 0 |
V8 BS - Encrypt | 10 | 611 | 61.1 | 619 | 61.9 | 0 |
V8 BS - Decrypt | 10 | 10502 | 1050.2 | 10512 | 1051.2 | 0 |
V8 BS - Regexp | 10 | 4768 | 476.8 | 4772 | 477.2 | 0 |
Microsoft JScript 9.0.16406
Name | Loops | Time | Avg | Time wr | Avg wr | Res |
---|---|---|---|---|---|---|
Empty test | 1,000,000 | 41 | 0.000041 | 82 | 0.000082 | 1,000,000 |
String concat | 100,000 | 38 | 0.00038 | 39 | 0.00039 | 2288895 |
Apply template | 10,000 | 18 | 0.0018 | 17 | 0.0017 | 590000 |
V8 BS - Richards | 100 | 166 | 1.66 | 166 | 1.66 | 0 |
V8 BS - Encrypt | 10 | fifteen | 1.5 | 37 | 3.7 | 0 |
V8 BS - Decrypt | 10 | 253 | 25.3 | 246 | 24.6 | 0 |
V8 BS - Regexp | 10 | 3175 | 317.5 | 3188 | 318.8 | 0 |
conclusions
The .NET compiler (more precisely, the results of its work) turned out to be the slowest. Either I'm doing something wrong, or he is just not good at anything. Interpreter from Microsoft versions less than 9th failed the test for the use of the template - the result is different from the rest. A closer examination showed that it differs in the assignment of the parameters of the callback function to replace.
Under Windows 7, it was not possible to test the compiler version from the .NET Framework 2.0, and version 4.0 behaved no less strange. The test worked for 20 minutes. Version 2.0 crashed with an error. For both versions, the test consumed up to 6 GB of memory. Why did the tests themselves show not such catastrophic times? A closer look at the problem revealed a strange feature of the compiler for Windows 7 x64: the V8 BS - Regexp test created the problems. Moreover, the compiled program began to devour memory even before the start of my code execution. It seems .Net somehow initializes regular expressions, which are abundant in this test, even before the code runs. Moreover, problems are observed if the regular expressions are in the function that creates the closure.
My final conclusion is this: the JScript compiler from the .NET Framework is good for nothing but testing the code for compilation errors. It also became interesting for me to test how C # will differ in such tasks. However, the “speedy” failure of JScript .NET begins to become clearer when you look at the stack trace when displaying error messages. I have not seen so many wrappers on simple calls.
However, the new interpreter from Microsoft JScript 9.0 is quite competitive, it is easy to extend its classes through ActiveScripting. Interesting is the choice of version. Why, after version 5.8, which was used in IE8, version 9.0 suddenly came out? However, after the official release, everything may change.
Leader in Google V8 shortness in NodeJS, but JScript 9.0 is on its heels. It seems to me that the final choice can be safely made not only by the criterion of speed, but by the sum of the factors. Including the convenience of expansion, debugging, integration with the platform.
And at the end - a meaningless, purely illustrative diagram. I just took the ratio of NodeJS time to the time of each test and averaged over the tests. Engine
rating (more is better) Links: NodeJS JSDB Google V8 Benchmark Suite version 6 Microsoft Windows Script Host Microsoft JScript