On 07/12/2017 04:56 PM, Konstantin Tokarev wrote:


12.07.2017, 22:35, "Phil Bouchard" <[email protected]>:
Phil Bouchard <[email protected]> wrote:
 On 07/11/2017 06:36 AM, Konstantin Tokarev wrote:
 10.07.2017, 21:56, "Phil Bouchard" <[email protected]>:
 Phil Bouchard <[email protected]> wrote:
 BTW converting Javascript into C++ seems very easy to do

 In fact, is it me or it would seem that:
 - converting the Javascript code into C++ on-the-fly
 - compiling the resulting C++ code

 This approach would have abysmal performance

 Would be a more efficient alternative than all these JIT tools?

 Not at all

 Maybe we can benchmark all this stuff once I'm done... just out of
 curiosity.

Actually I just did a benchmark of my "js2cpp" tool and interpreting the
code using Node.JS and js2cpp generates an executable that is 34 times
faster!

Now add time of compilation to the sum

So I just did benchmark the following C++ file featuring a loop within the code (the loop was at the bash shell level previously):
https://github.com/philippeb8/root_ptr/blob/qt/example/javascript_example1.cpp

With the exact equivalent in Javascript:
https://github.com/philippeb8/root_ptr/blob/qt/example/javascript_example1.js

And the executable generated by g++ is still 1.7 times faster than by using Node.JS. For small Javascript perhaps the net speed are the same but the more complex the code is then the generated binary by g++ simply is faster when compared to the Node.JS interpreter.


Thanks,
-Phil

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to