aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/environmentscriptrunner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Re-use product, module and project script valuesChristian Kandeler2018-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These script values were set up from scratch not only for every rule, but also when creating the dependencies array. As a result, a rule traversing the dependencies of a product recursively would potentially create a huge amount of identical script values for modules appearing more than once in the dependency graph, such as the qbs module. See the benchmark data below for how the performance degraded with the size of the project. Instead, we now re-use these values, which stay valid throughout the lifetime of the script engine. For prepare scripts, that's the same as the lifetime of the executor. As a side effect, this also gives us change tracking for accesses to product and module properties via the dependencies array. These were completely unobserved before. Benchmarker result using qbs as the test project: ========== Performance data for Rule Execution ========== Old instruction count: 3265471304 New instruction count: 2733833913 Relative change: -17 % Old peak memory usage: 19023592 Bytes New peak memory usage: 19871640 Bytes Relative change: +4 % Benchmarker result using Qt Creator as the test project: ========== Performance data for Rule Execution ========== Old instruction count: 318848392341 New instruction count: 75056789023 Relative change: -77 % Old peak memory usage: 248922136 Bytes New peak memory usage: 258454408 Bytes Relative change: +3 % Change-Id: Id69062eea4dd8f9c7153599610c52bf4ea986464 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Introduce a named constant for the magic "_qbs_procenv" variableChristian Kandeler2018-01-181-6/+2
| | | | | Change-Id: I17df1d5465afd3c19f71ab00e361c546ec8bb45d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* corelib: Gather string constants in central placeChristian Kandeler2017-11-291-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The same string literals appeared over and over again in the code base, causing redundancy in the sources as well as at run-time. We now give them a name and make sure they get instantiated at most once. String literals that occur only once are converted from QLatin1String to QStringLiteral unless they appear only in contexts that make use of QLatin1String overloads or they are clearly outside of any hot code paths. This seems to result in small, but measurable performance improvements, even if we assume the 1% changes to be noise: ========== Performance data for Resolving ========== Old instruction count: 3266514138 New instruction count: 3209355927 Relative change: -2 % Old peak memory usage: 29649896 Bytes New peak memory usage: 29436264 Bytes Relative change: -1 % ========== Performance data for Rule Execution ========== Old instruction count: 3367804753 New instruction count: 3319029596 Relative change: -2 % Old peak memory usage: 19577760 Bytes New peak memory usage: 19091328 Bytes Relative change: -3 % ========== Performance data for Null Build ========== Old instruction count: 608946535 New instruction count: 604566001 Relative change: -1 % Old peak memory usage: 14606384 Bytes New peak memory usage: 14579936 Bytes Relative change: -1 % Change-Id: Ia055a52e0a4b6fe6fd0f1e7ba4bfa583cba1b0ef Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Share ScriptFunction objects between productsChristian Kandeler2017-11-231-11/+13
| | | | | | | | | | | The source code of script functions does not differ among module instantiations, so there's no need to give each product its own copy. For example, resolving the QtCreator super project now allocates about 80 of these objects, rather than 16000, each of which had their own unshared copy of the script source code. Change-Id: I10d67991ce170826346d434fe58ea6608fa18a1f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* STL compatibility: use push_back() instead of append()Jake Petroules2017-11-221-5/+5
| | | | | | | | | | ...or operator<< if the argument was itself a list, or brace init where appropriate. This is a simple find and replace with manual sanity check. Change-Id: I94b79cbf3752192dd258001bf1dfcd46f58ca352 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Give the setupRunEnvironment script an additional parameterChristian Kandeler2017-11-221-4/+8
| | | | | | | | | | | Required by follow-up commit. [ChangeLog] The Module.setupRunEnvironment script now has a new parameter "config". Users can set it via the --setup-run-env-config option of the run command. Change-Id: I1be57fcff5321874cf3dcf4fb3a7ef7d6f69a8a5 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Make Module.setup{Build,Run}Environment first-class citizensChristian Kandeler2017-11-201-0/+219
They did not have the project and product variables available, and they accessed module properties in a way that made it look as if they were normal properties rather than scripts, which was misleading. Now everything works the same as in Rule scripts and JS commands. Task-number: QBS-744 Change-Id: I11d70876185d528282a56747747dd8310a77fbc4 Reviewed-by: Jake Petroules <jake.petroules@qt.io>