Details
-
Epic
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
-
Evaluate Dynamic Linking
-
Description
Currently in Qt for WebAssembly we support only static linking. A lot of customer are asking for "dynamic linking", but this term can be ambiguous and can mean a lot of different stuff for different customers.
We need to conduct proper analysis to make sure that we are really solving the problem that customers have.
Dynamic linking has both it pros and cons. Fundamentally it should allow us to to divide QT and its plugins into multiple modules and load them independently during load-time or runtime.
(wording: module = wasm binary that can be loaded dynamically)
PROS:
- browser should be able to cache network requests for fetching modules, this should speed up running multiple user application which link to the same Qt version on one machine/browser
- only needed plugins can be loaded on demand, instead of loading entire Qt framework, which could reduce the size of binary (but look Q3)
- modules can be recompiled and deployed separately, which can improve developer experience
- loading only required modules at startup instead of entire static binary should improve application loading time
- static linking is problem for LGPL licence
CONS:
- building is more complicated: currently it requires patching emscripten, building it locally from source and doing some other extra steps, it can be very cumbersome for customers
- there is a performance penalty, calling function between different modules is more expensive and less performant than calling them inside one binary
- not all features are supported, for example both multithreading and asyncify are not supported. Our Qt doc also mentions that Chrome browser is not supported
- for now (9.01.2024) its not stable, there are a lot of bugs which needs to be solved first
QUESTIONS:
Q1: What exactly is the problem that customers have? Is dynamic linking a solution to that problem? Are there any other solutions we can propose instead?
Q2: Dynamic linking can be implemented in many ways. Are we confident which variant suits our needs the best? What are the trade-offs? For example having QtCore, QtQML, QtQuick linked statically together or not? Maybe it's enough to only link plugins separately?
Q3: Does loading plugins separately really offer smaller total binaries size? Static build should do dead code elimination, is not it enough to remove unwanted code? How does the total static binary size compares to dynamic linking with plugins?
Q4: What is the performance cost of dynamic linking? Is it acceptable? Some benchmarking may be needed.
Q5: Is our documentation up to date? Is Chrome browser really not supported?
Q6: Do we know any customer who is using dynamic linking technical preview? If yes, do they have any feedback?