For the test, I’m not going to use everything in ReactJS.NET but only JSPool and everything below.
I’m running it on my laptop with following configurations:
- Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
- 16.GB RAM
- Windows 10 Home 64-bit
- 512 GB SSD
For each engine, I would 10 cycles initialization and procession of 1000 commands. As A command I’ve selected a server-side rendering of a header component used in previous posts. The component in generated as a part of a WebPack package that includes React & Redux. A size of the package is ~2mb.
To start with I need to mention that not all engines were able to finish. Jurassic start throwing errors and was abandoned.
Here is a timing for each tested engine:
|JS Engine||Initialization, s||Execution time for 1k, s||Max Memory used, ~MB|
|ClearScript V8||2.66||6.94||190 *|
And also scores:
|JS Engine||Initialization||Execution time for 1k||Max Memory used|
|ClearScript V8||1.82||1.24||1.00 *|
In tables above you can see that engines except Jint are doing a good job. Vroom and ClearScript V8 both have Google V8 under the hood and execution time seems to be
Vroom and ClearScript V8 both have Google V8 under the hood and execution time seems to be similar as well. However, ClearScript does a better job in memory management.
MSIE and ChakraCore are pretty much the same engines as well but called differently. MSIE expects that you will have IE installed and goes through it, while Chakra Core is MS new JS engine itself. That is explaining overhead in an execution of scripts. (Did you know that CC is cross-platform and there is a CC version of NodeJS?)
Finally, based on all three params in the test, I declare CC a winner. Second place goes to ClearScript V8.
ClearScriptV8 and ChakraCore are 2 solid candidates to be used in Sitecore to integrate it with JS. Based on all three params in the test, I declare CC a winner 🙂
As a side effect of this test, I thought that for Sitecore we don’t need everything in ReactJS.NET module. I’ve overridden and replaced a lot over there already. We could just create JSPool with CC Engine in Sitecore initialization pipeline and extend Sitecore controller with wrappers to render methods. That is what I’m planning to do next.
Follow me on twitter @true_shoorik. Would be glad to discuss ideas above in comments.