Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QJSEngine vs. (deprecated) QScriptEngine performance - old thing winning!

QJSEngine vs. (deprecated) QScriptEngine performance - old thing winning!

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kovadlina
    wrote on last edited by
    #1

    Re: QScriptEngine vs. QJSEngine?

    I was given a task to compare performance scripting solutions in Qt and to my surprise QScriptEngine was the absolute winner of the contest, especially with the ability of keeping pre-parsed script in QScriptProgram.
    The evaluation of 30.000 expressions was 3-6 times better on first evaluation round, 6-30 times on the repeated evaluation (depending on formulae complexity reaching from simple calculation "100 + (5/1.23)" to more complicated 2 line expressions with some variable bindings).

    I was truly astonished that QJSEngine performed that miserably at simple calculations as it is the engine powering QML. Maybe QJSEngine-QQmlEngine is optimized toward property notifications/changes, maybe this performance gap is the reason why QtScript was not yet been phased out.
    Maybe I am completely wrong in general. Anyone else experienced this?

    Code involved is here in https://bitbucket.org/kovis/qtscripting/commits/501e8c4264cd124fd1ec6b82670d6f947c9c2859?at=default

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I'd recommend bringing this to the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kovadlina
        wrote on last edited by
        #3

        You were right, Ulf Hermann on the interest mailing list pointed me very swiftly to the way how QJSEngine can do precompiled things.

        QJSValue fun = myEngine.evaluate("(function(a, b) { return a + b;})");
        QJSValueList args; args << 1 << 2;
        QJSValue threeAgain = fun.call(QJSValue(), args); regards,

        So you need to keep the precompiled functions and corresponding myEngine alive and the evaluation runs very quickly, beating the QScriptEngine

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved