Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.5, 6.8, 6.9, 6.10
-
None
-
2afe05b64 (tqtc/lts-6.5), a85d36b8a (6.10), bb98127e3 (6.10), 2993762d3 (6.9), cf15698d4 (6.9), ca8b14feb (6.9), c36360eb1 (6.9), 9bfcc36f2 (tqtc/lts-6.8), 9bc25cd53 (tqtc/lts-6.8), dfc56c205 (tqtc/lts-6.8), 564d2eb26 (tqtc/lts-6.8), b9974d82c (dev)
Description
The example from https://www.qt.io/blog/compiling-qml-to-c-a-4x-speedup doesn't compile to C++ anymore. You instead get:
Categorizer.qml:24: warning: Could not compile binding for numbers: Cannot generate efficient code for storing an array in a non-sequence type [compiler] Categorizer.qml:39: warning: Could not compile function sum: Cannot generate efficient code for LoadElement on a sequence potentially affected by side effects [compiler] Categorizer.qml:59: warning: Could not compile binding for onCompleted: Cannot generate efficient code for LoadElement on a sequence potentially affected by side effects [compiler]
There's no obvious reason for this. The array shouldn't have to be stored in anything but list<double> and the numbers in sum() are not actually affected by any side effects.
In onCompleted it probably assumes console.log() has side effects. We could deal with that by starting to mark specific functions as pure. However, onCompleted is not the hot code path here.
Attachments
Issue Links
- is duplicated by
-
QTBUG-137558 Qt Quick Compiler fails to compile array
-
- Closed
-
For Gerrit Dashboard: QTBUG-137540 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
656262,3 | WIP: QmlCompiler: Discern between different kinds of side effects | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: NEW | -2 | 0 |