Details
-
User Story
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
-
75ac345d6 (dev), 2aaafa0b5 (6.7), 1ac022a95 (dev), a9ed0cab4 (dev), a92e6c17d (dev), 590d537fd (6.7), 1d638416e (dev), 963628350 (dev), f495d4508 (dev), bf56c4b64 (tqtc/lts-6.5), bd8107e22 (tqtc/lts-6.2), 2cc38c87a (tqtc/5.15), cb6e61d6c (tqtc/lts-5.15)
Description
As we deploy your packages with each release, we have notice that adding a wrapper around the Qt binaries could be reduced, so this Story is to track the progress around it.
For a final goal, the team aims to get a 30% reduction in most of our wrappers.
Currente state 04.2024
In the case of QtCore (Linux), we deploy the Qt binary, which is:
6.8M PySide6/Qt/lib/libQt6Core.so.6
and on top of that our wrapper:
4.4M PySide6/QtCore.abi3.so
Meaning that only for providing QtCore compatibility, we need more than 10MB, which when deploying applications, this becomes a problem.
Ideas
There has been a few ideas on how to reduce the size, but it's probable that other will appear as well, for example:
- Identifying common bound methods signatures (say void(int)) and create library code to handle it instead of verbosely generating the code
- Removal of the strings we have within the wrapper (signatures)
- exporting only a few symbols when generating the wrapper
- Reducing the generated code by some sections, or improving processes
- etc
Preliminary Exploration
PySide's code generator does a good job in automatically creating wrappers and support functions for everything. The problem with that is that it creates lots of similar code.
By identifying repeated patterns, it should be possible to build more general functions, which are called with the same arity but different parameter values.
The first step before creating actual different code is to prepare some measurement how much the generated functions can be folded. This should give some estimate of the expected savings.
Outline of an Analysis Function
- Write a simple parser which can extract all functions that cppgenerator.cpp creates.
- Ignore the function names.
- Replace every constant in a function by its type name and a sequential number.
The output should then be an abstraction of the generated functions, because the concrete
constants are removed by a place holder.
These nameless function bodies can then be reduced by uniq(). What remains are hopefully
a lot less functions, which just have to be called with arguments that fill the place holders.
If the result sounds promising, we can turn to the quite complex implementation.
Attachments
Issue Links
- is duplicated by
-
PYSIDE-2783 Find Ways to Reduce Executable Size
- Closed
- relates to
-
PYSIDE-996 Current COIN Wheel Tester Problems
- Closed
Gerrit Reviews
For Gerrit Dashboard: PYSIDE-2701 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
569051,11 | shiboken: Estimate possible reduction of generated methods | dev | pyside/pyside-setup | Status: NEW | 0 | 0 |
607096,8 | WIP: shiboken: Try to fold some return code sequence. | dev | pyside/pyside-setup | Status: NEW | -2 | 0 |