diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-02-21 15:02:31 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2023-02-07 09:20:11 +0000 |
commit | 087c22e17721f37490dd2048a567b6a58065d939 (patch) | |
tree | 3a04067c29884685fe7189b5c51c1fff82f214d9 /share | |
parent | 4e8f377f1844bbb2f5ed7cb4481d6e30a6335da5 (diff) | |
download | qbs-087c22e17721f37490dd2048a567b6a58065d939.tar.gz |
Switch JavaScript back-end
Newer clang versions seem to expose serious bugs in QtScript, whose
complexity makes it difficult to track them down.
We therefore switch to the more light-weight QuickJS, which offers all
the features we need (most notably property access interception), as
well as good performance.
To save some porting effort, we removed the long-deprecated loadFile()
and loadExtension() functions.
During the porting procedure, we noticed and fixed thread safety issues
in artifact access from JS commands.
We consider this change important enough to bump the major version, so
the next release will be 2.0.
Detailed benchmarking data is below. In summary, we see a modest speed-
up at the cost of a similarly modest increase in memory consumption
(with the exception of project resolving on macOS, which has become a
bit slower). Importantly, the increase does not rise with project size,
as the comparison of qbs vs Qt Creator shows.
Output of qbs_benchmarker on Linux with qbs as test project:
========== Performance data for Resolving ==========
Old instruction count: 12870602895
New instruction count: 11923459780
Relative change: -8 %
Old peak memory usage: 61775848 Bytes
New peak memory usage: 67583424 Bytes
Relative change: +9 %
========== Performance data for Rule Execution ==========
Old instruction count: 4074062223
New instruction count: 3887473574
Relative change: -5 %
Old peak memory usage: 35123704 Bytes
New peak memory usage: 38398392 Bytes
Relative change: +9 %
========== Performance data for Null Build ==========
Old instruction count: 1104417596
New instruction count: 1011033948
Relative change: -9 %
Old peak memory usage: 24461824 Bytes
New peak memory usage: 25325920 Bytes
Relative change: +3 %
Output of qbs_benchmarker on Linux with Qt Creator as test project:
========== Performance data for Resolving ==========
Old instruction count: 67166450352
New instruction count: 60772791018
Relative change: -10 %
Old peak memory usage: 327011616 Bytes
New peak memory usage: 343724176 Bytes
Relative change: +5 %
========== Performance data for Rule Execution ==========
Old instruction count: 71684351183
New instruction count: 67051936965
Relative change: -7 %
Old peak memory usage: 374913688 Bytes
New peak memory usage: 387790992 Bytes
Relative change: +3 %
========== Performance data for Null Build ==========
Old instruction count: 8383156078
New instruction count: 7930705668
Relative change: -6 %
Old peak memory usage: 180468360 Bytes
New peak memory usage: 182490384 Bytes
Relative change: +1 %
Real-world data building Qt Creator (using qbs --log-time, several runs,
removing outliers):
macOS:
Resolving: 43s -> 47s
Rule execution: 17s -> 14s
Windows:
Resolving: 18s -> 16s
Rule execution: 22s -> 17s
Fixes: QBS-913
Fixes: QBS-1103
Fixes: QBS-1126
Fixes: QBS-1227
Fixes: QBS-1684
Change-Id: Ie5088155026e85bbd1e303f1c67addb15810a3cb
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/msvc.js | 4 | ||||
-rw-r--r-- | share/qbs/modules/cpp/sdcc.js | 3 | ||||
-rw-r--r-- | share/qbs/modules/cpp/windows-clang-cl.qbs | 3 | ||||
-rw-r--r-- | share/qbs/modules/dmg/dmg.js | 6 | ||||
-rw-r--r-- | share/qbs/modules/qbs/common.qbs | 5 |
5 files changed, 11 insertions, 10 deletions
diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index 1b70904c0..748095aff 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -387,11 +387,11 @@ function prepareLinker(project, product, inputs, outputs, input, output) { var linkDLL = (outputs.dynamiclibrary ? true : false) var primaryOutput = (linkDLL ? outputs.dynamiclibrary[0] : outputs.application[0]) var debugInformation = product.cpp.debugInformation; - var additionalManifestInputs = Array.prototype.map.call(inputs["native.pe.manifest"], + var additionalManifestInputs = Array.prototype.map.call(inputs["native.pe.manifest"] || [], function (a) { return a.filePath; }); - var moduleDefinitionInputs = Array.prototype.map.call(inputs["def"], + var moduleDefinitionInputs = Array.prototype.map.call(inputs["def"] || [], function (a) { return a.filePath; }); diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index 928ded5cf..9861da296 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -461,10 +461,9 @@ function renameLinkerMapFile(project, product, inputs, outputs, input, output) { // remove a listing files only after the linking completes. function removeCompilerListingFiles(project, product, inputs, outputs, input, output) { var cmd = new JavaScriptCommand(); - cmd.objects = inputs.obj.map(function(a) { return a; }); cmd.silent = true; cmd.sourceCode = function() { - objects.forEach(function(object) { + inputs.obj.forEach(function(object) { if (!object.filePath.endsWith(".c" + object.cpp.objectSuffix)) return; // Skip the assembler generated objects. if (!object.cpp.generateCompilerListingFiles diff --git a/share/qbs/modules/cpp/windows-clang-cl.qbs b/share/qbs/modules/cpp/windows-clang-cl.qbs index cc58097f6..bc69faf06 100644 --- a/share/qbs/modules/cpp/windows-clang-cl.qbs +++ b/share/qbs/modules/cpp/windows-clang-cl.qbs @@ -86,13 +86,14 @@ MsvcBaseModule { linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) validateFunc: { + var baseFunc = base; return function() { if (_skipAllChecks) return; var validator = new ModUtils.PropertyValidator("cpp"); validator.setRequiredProperty("vcvarsallPath", vcvarsallPath); validator.validate(); - base(); + baseFunc(); } } } diff --git a/share/qbs/modules/dmg/dmg.js b/share/qbs/modules/dmg/dmg.js index 4d972db9b..636a34af3 100644 --- a/share/qbs/modules/dmg/dmg.js +++ b/share/qbs/modules/dmg/dmg.js @@ -57,7 +57,7 @@ function dmgbuildSettings(product, inputs) { volumeIcon = volumeIcons[0].filePath; } - var licenseFileObjects = Array.prototype.map.call(inputs["dmg.license"], function (a) { + var licenseFileObjects = Array.prototype.map.call(inputs["dmg.license"] || [], function (a) { return { "dmg": { "licenseLocale": localizationFromArtifact(a), @@ -97,7 +97,7 @@ function dmgbuildSettings(product, inputs) { }, {}); } - var contentsArray = Array.prototype.map.call(inputs["dmg.input"], function (a) { + var contentsArray = Array.prototype.map.call(inputs["dmg.input"] || [], function (a) { if (a.dmg.sourceBase && !a.filePath.startsWith(a.dmg.sourceBase)) { throw new Error("Cannot install '" + a.filePath + "', " + "because it doesn't start with the value of " + @@ -114,7 +114,7 @@ function dmgbuildSettings(product, inputs) { }; }); - Array.prototype.forEach.call(product.dmg.iconPositions, function (obj) { + Array.prototype.forEach.call(product.dmg.iconPositions || [], function (obj) { var existingIndex = -1; Array.prototype.forEach.call(contentsArray, function (contentsItem, i) { if (contentsItem["name"] === obj["path"]) diff --git a/share/qbs/modules/qbs/common.qbs b/share/qbs/modules/qbs/common.qbs index 8ddfc582d..530bcb2d2 100644 --- a/share/qbs/modules/qbs/common.qbs +++ b/share/qbs/modules/qbs/common.qbs @@ -143,8 +143,9 @@ Module { validator.addCustomValidator("architecture", architecture, function (value) { return !architecture || architecture === Utilities.canonicalArchitecture(architecture); - }, "'" + architecture + "' is invalid. You must use the canonical name '" + - Utilities.canonicalArchitecture(architecture) + "'"); + }, "'" + architecture + "' is invalid." + (architecture + ? " You must use the canonical name '" + Utilities.canonicalArchitecture(architecture) + : "") + "'"); validator.addCustomValidator("toolchain", toolchain, function (value) { if (toolchain === undefined) |