3 ms·
Comparing Qt overhead to the insane overhead of JavaScript frameworks is a little far fetched.
by spaetzleesser 4y ago
Comparing Qt overhead to the insane overhead of JavaScript frameworks is a little far fetched.
- ajuc 4y agoQt has QML which is a js framework :)
- JustSomeNobody 4y agoOptional isn't it?
- Kelteseth 4y agoYou can call js functions in qml, but that does not mean qml is a js framework. Normally you call your c++ functions from qml.
- ajuc 4y agoI don't want to disparage qt+qml, I used it commercially and it's much better than other gui frameworks I worked with. I just dislike people bashing technology for the wrong reason (like it being a "js framework"). In qt+qml usually you connect slots to signals in js, even if they are implemented in c++.
- chrisseaton 4y agoA function call in JS is usually just a few machine instructions. It's an example of a case where a conventional C++ compiler can do less optimisation than a JIT JS compiler.
- int_19h 4y agoI would find it extremely surprising if a regular function call in C++ took any more instructions than in JS. Now a virtual function call, a JIT compiler can devirtualize more often than an AOT compiler. But the vast majority of function calls in your typical C++ app are not virtual.
- chrisseaton 4y ago> I would find it extremely surprising if a regular function call in C++ took any more instructions than in JS. We're talking about Qt 'signals' though - they're sort of heavy-weight virtual call, reimplemented in C++, not regular function calls.
- int_19h 4y agoThen you should be comparing them with the direct JavaScript equivalent, which would be something like an array of functions and a foreach/invoke over that. It should also be noted that Qt signals are far from the optimal way this can be implemented in C++. On top of that, C++ itself makes it more complicated than it needs to be by not providing a bound (to receiver) member function pointer as a primitive; but even then, this can be done in two indirections. A compiler for a language that supports such a facility directly - say, Delphi - can compile it down to a single indirection.
- chrisseaton 4y ago> Then you should be comparing them with the direct JavaScript equivalent, which would be something like an array of functions and a foreach/invoke over that. But again... a JS JIT could unroll that loop, leaving with just a couple of instruction per call and no loop.
- spaetzleesser 4y agoDoes it or maybe could? I hear a lot about the miracles of JS JIT but from my experience C++ code will run circles around JS code in real world scenarios.