[Qbs] QBS script parsing speed

Jochen Ulrich jochen.ulrich at clausmark.com
Tue Jun 30 10:24:51 CEST 2020


We faced similar problems but our resolve times were even higher (30 s to 2 mins).

We were able to work around this and significantly reduce the resolve times by avoiding transitive dependencies (meaning exporting dependencies).

So instead of this:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Product {
    name: “A”
    Depends { name: "B" }
}

Product {
    name: “B”
    Depends { name: "C" }
    Export {
        Depends { name: "C" }
    }
}

Product {
    name: “C”
    Depends { name: "SomeLibNeededEverywhere" }
    Export {
        Depends { name: "SomeLibNeededEverywhere" }
    }
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

You do it like this
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Product {
    name: “A”
    Depends { name: "B" }
    Depends { name: "C" }
    Depends { name: "SomeLibNeededEverywhere" }
}

Product {
    name: “B”
    Depends { name: "C" }
    Depends { name: "SomeLibNeededEverywhere" }
}

Product {
    name: “C”
    Depends { name: "SomeLibNeededEverywhere" }
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Of course it is ugly because you have to maintain the transitive dependencies manually.
However, if you have cases where a dependency is needed in many places, you can create custom products that include it.
For example:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// qbs/imports/MyBaseApplication.qbs
CppApplication {
    Depends { name: "SomeLibNeededEverywhere" }
}

// in other .qbs files use MyBaseApplication instead of CppApplication
MyBaseApplication {
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

See also this thread on the mailing list:
https://lists.qt-project.org/pipermail/qbs/2019-July/002477.html
and the follow up:
https://lists.qt-project.org/pipermail/qbs/2019-August/002544.html

Kind regards
Jochen Ulrich

> Von: Qbs <qbs-bounces at qt-project.org> im Auftrag von Карелин Павел <hkarel at yandex.ru>
> Datum: Dienstag, 30. Juni 2020 um 09:45
> An: "qbs at qt-project.org" <qbs at qt-project.org>
> Betreff: [Qbs] QBS script parsing speed
> 
> Hello.
> 
> Now I'm trying to write a QBS build script for a fairly large project (QGIS). After making every change to the build script - the project tree is rebuilt and QtCreator freezes for 10-15 seconds.
> It seems that 10-15 is not so much, but since I have to make a lot of changes in the script, in the aggregate the slowdown turns out to be quite significant.
> I suppose I was not the only one who faced a similar problem on large projects. I would like to know if any measures are being planned to increase the speed of re-parsing a project?
> I am using QtCreator 4.11.2 (QBS 1.15.1)
> 
> 
> --
> BR, Pavel Karelin



More information about the Qbs mailing list