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

Ulf Hermann ulf.hermann at qt.io
Wed Oct 12 13:30:55 CEST 2016


> The usage scenario fits my needs, that is the reason to evaluate exactly this way.
>
> I mean - should the QScriptEngine be deprecated, the QQmlEngine/QJSEngine should also have ways to utilize some form of JIT/preparse. Even in the first pass where JIT cannot be effective (or when I parse just the text expression) QScriptEngine beats newer and more shiny QJSEngine a lot. That is confusing to me and my point - why is QJSEngine offered as replacement of QScriptEngine when it is so much slower?

QJSEngine does not cache the compilation results if you just pass in plain strings. I also don't think QScriptEngine can do this here (but I haven't checked). QScriptEngine might be clever enough to automatically use the interpreter rather than JIT-compiling such small expressions. You can set the QV4_FORCE_INTERPRETER environment variable to force QJSEngine to use the interpreter rather than the JIT.

In any case it's a waste to parse the expressions from strings over and over and to not use the JIT. If you care about performance, you should try to parse the expressions only once.

Ulf



More information about the Interest mailing list