What is the "cost" of using unnecessary imports on QML ?



  • What is the "cost" of using unnecessary imports on QML ?



  • Generally it depends on which type of import it is (installed module vs located module vs components directory vs JavaScript resource).

    If it is an installed or located module, the cost can be quite high in some circumstances (plugin loading and calling into the type registration function). If it is a components directory with a qmldir listing file, or module without a plugin, the cost is somewhat lower (the import system will parse the qmldir file and enumerate the available typenames but shouldn't parse the QML documents or load the type until/unless they're used). If it is a components directory without a qmldir listing file, the cost should be nil unless you use one of the types specified. If the import is a JavaScript resource, the cost will be substantial, since the file is parsed and loaded, and then evaluated, at import time.

    Cheers,
    Chris.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.