Nominate our 2022 Qt Champions!

Portable Logic (body)

  • Martin Fowler talk in this article of portable body (logic) (slide 23). He talk thinking a web, i instead think to Qt/Qml, where Qml is the native gui and c++/javascript is the portable body. Is exsisting a benchmark between qml/Qt vs Hybrid(web+native; javascript+native) applications? For me this is an interesting point. If someone wants to help me in this comparison, I would be happy.

  • Link you provided doesn't work anymore.
    Theoretically you could just copy JavaScript part and make QML elements corresponding to HTML tags.
    However, I haven't done such thing so I can't be 100% sure about it.

  • I have corrected the link (sorry for the error). maybe aint clear my post, i would to demonstrate that qml/qt is better than solutions Fowler's proposal.

  • Hi,

    In pretty much every benchmark I've ever seen, the performance of native, compiled code thrashes the performance of JS code run by a browser's JS engine. The only case where it doesn't, is the "compile and run once" time (compilation time of native code dominates runtime, generally, because absolutely everything - including cold-code - is optimised, whereas modern JavaScript engines are designed to minimise compile+run-once time, in the common case). As for using CSS to do animations and UI stuff, well, yeah, again, every benchmark I've ever seen shows native code coming out on top.

    QML is a special case because it's a hybrid, itself. It allows the application logic to be entirely implemented in either C++ or JavaScript, and the application UI to be entirely implemented in QML. The visual elements in the QML-defined scene can themselves be native widgets, or user-defined controls.

    The current implementation of the QML engine does most stuff at run-time (interprets everything into intermediate bytecode format, builds metaobjects at runtime, instantiates instances of those types, assigns properties, builds binding expressions and runs them, etc) but the implementation could certainly be improved to do more stuff natively (eg, the compilation step could involve emitting binding expressions in IR form, which then get converted to C++ code by the engine, to be compiled by a C++ compiler for real-native performance of bindings).

    Apart from the fact that no standard QML web runtime plugin exists for the major browsers, I personally think that QML is the best form of hybrid solution in the world today. But I might be biased ;-) Performance-wise, it thrashes pretty much every non-native, non-compiled solution I've seen, at the very least, while still having a nice syntax and run-time extensibility.


Log in to reply