qtdeploy too slow even using "-fast"

Created on 24 Apr 2018  路  5Comments  路  Source: therecipe/qt

I am using "qtdeploy test". I think "qtdeploy build" is not a big problem because it is only used when I want to release. But "qtdeploy test" is used all the time when developing. "qtdeploy -fast test" took me about 60 seconds when testing the sample "qt\internal\examples\uitools\calculator". I am wondering if it can be optimized.

  1. I did some tests and found qtdeploy itself is not a problem, most time is occupied by "go build" command. And I also found that evey time I executed "qtdeploy test", the "go installed" file in "pkg" dir is always updated. For example, when I test the the sample "qt\internal\examples\uitools\calculator", "core.a, gui.a, widgets.a", these three files will be updated everytime. Is it normal? As I known, when a package is installed, if the source code of the library is not changed, this file will not be updated.

2.Could I custom build modules? For example, I just want to write an application based on qt widgets. Then I just want to build core, gui, widget. If only build these three modules, could it speed up "qtdeploy test"?

Most helpful comment

@ismlsmile

these three files will be updated everytime. Is it normal? As I known, when a package is installed, if the source code of the library is not changed, this file will not be updated.

Yes, this is because qtdeploy calls qtminimal to generate a subset of the binding based on you project's code, to make the finally binary size smaller. (This newly generated code will be then be needed to be compiled again.)

2.Could I custom build modules? For example, I just want to write an application based on qt widgets. Then I just want to build core, gui, widget. If only build these three modules, could it speed up "qtdeploy test"?

Sorry, I'm not sure what you mean exactly.
When you just import "core", "gui", "widgets" then qtdeploy should only generate/build/compile these three modules. (Or do you mean during the installation while running qtsetup? Because the unused modules shouldn't impact the qtdeploy build time at all.)

@arsham

On a second thought, maybe the author would create a new wiki page and point out the steps needed to refactor this beauty. A call graph also helps, and there needs to be a lot of tests to make sure it doesn't break. I'm not saying it's easy, but it's worth it big time.
I'm all up for it, I can manage some spare time decomposing the codes. @therecipe what do you reckon?

Yeah, I'm planning to make the generator code more accessible and start to document the internals.
But at the moment I'm more focused on the outer shell (creating best practice examples, updating the general documentation of the tooling + how to deploy your applications, and a lot of other totally undocumented stuff like how to directly make use of the docker files or how to make use of vagrant.)
Then fix the stuff necessary for Qt 5.11, after that move + re-brand the repo in the beginning of june.
And then I planned to start documenting the internals and write proper tests, so that the code can be easily refactored with the goal to cut down the time needed to compile the generated glue code (+ solve some binary size issues related to qtmoc).

All 5 comments

Calculator example runs in about 33s with qtdeploy test desktop on my laptop (Arch Linux, i7, Qt5.10.1). Following that, with -fast flag it runs at about 8s. Having said that, if you'd be careful with your resources (not using qml:/ directive), you can actually run your application with go run main.go, which is handy, and I've noticed it was a bit faster in some cases. There is another option: qtrcc && go build && ./calculator, which I think manually invokes qtdeploy internals (not sure, but it looks like it).

Regarding the send point, it is an excellent idea and it's already been discussed. I encourage you to give it a thumbs up.

On a second thought, maybe the author would create a new wiki page and point out the steps needed to refactor this beauty. A call graph also helps, and there needs to be a lot of tests to make sure it doesn't break. I'm not saying it's easy, but it's worth it big time.

I'm all up for it, I can manage some spare time decomposing the codes. @therecipe what do you reckon?

Thanks for your reply.
My PC is win10 and i5, Qt 5.10.1. I try the calculator sample and add some test code to qtdeploy to print the time. I start the test in a clean folder and do not clean any generated files during the tests.

  1. First time, run "qtdeploy test desktop":
    start qtdeploy = 2018-04-25 09:58:39.629
    ERRO[0011] failed to load D:\Dev\Qt5.10.0\Docs\Qt-5.10.0\qtscript\qtscript.index error="open D:\Dev\Qt5.10.0\Docs\Qt-5.10.0\qtscript\qtscript.index: The system cannot find the path specified."
    ..........
    ..........
    ..........
    ..........
    end qtdeploy = 2018-04-25 10:00:28.393

about 110s

  1. Second time, run "qtdeploy -fast test desktop":
    start qtdeploy = 2018-04-25 10:03:41.441
    end qtdeploy = 2018-04-25 10:04:56.76

about 75s

  1. If I run again, it is fast:
    start qtdeploy = 2018-04-25 10:05:27.175
    end qtdeploy = 2018-04-25 10:05:32.579

about 5s

  1. But If I modify the calculator.go file and run again:
    start qtdeploy = 2018-04-25 10:06:43.594
    end qtdeploy = 2018-04-25 10:07:54.853

about 70s

  1. And I print the time around go build(and also modify the calculator.go):
    start qtdeploy = 2018-04-25 10:10:40.419
    start go build = 2018-04-25 10:10:45.351
    end go build = 2018-04-25 10:11:53.656
    end qtdeploy = 2018-04-25 10:11:54.95

most time is occupied by "go build" command

Well, that makes sense as the go tool in this library is calling cgo.

@ismlsmile

these three files will be updated everytime. Is it normal? As I known, when a package is installed, if the source code of the library is not changed, this file will not be updated.

Yes, this is because qtdeploy calls qtminimal to generate a subset of the binding based on you project's code, to make the finally binary size smaller. (This newly generated code will be then be needed to be compiled again.)

2.Could I custom build modules? For example, I just want to write an application based on qt widgets. Then I just want to build core, gui, widget. If only build these three modules, could it speed up "qtdeploy test"?

Sorry, I'm not sure what you mean exactly.
When you just import "core", "gui", "widgets" then qtdeploy should only generate/build/compile these three modules. (Or do you mean during the installation while running qtsetup? Because the unused modules shouldn't impact the qtdeploy build time at all.)

@arsham

On a second thought, maybe the author would create a new wiki page and point out the steps needed to refactor this beauty. A call graph also helps, and there needs to be a lot of tests to make sure it doesn't break. I'm not saying it's easy, but it's worth it big time.
I'm all up for it, I can manage some spare time decomposing the codes. @therecipe what do you reckon?

Yeah, I'm planning to make the generator code more accessible and start to document the internals.
But at the moment I'm more focused on the outer shell (creating best practice examples, updating the general documentation of the tooling + how to deploy your applications, and a lot of other totally undocumented stuff like how to directly make use of the docker files or how to make use of vagrant.)
Then fix the stuff necessary for Qt 5.11, after that move + re-brand the repo in the beginning of june.
And then I planned to start documenting the internals and write proper tests, so that the code can be easily refactored with the goal to cut down the time needed to compile the generated glue code (+ solve some binary size issues related to qtmoc).

I have similar (experience, I am new to both QT and golang QT binding;
using a thinkpad laptop with (i5-6400U CPU, 24G mem and SSD), windows 10
first time , it took about 7 minutes to run "qtdeploy -fast test" therecipe/example/basic/widgets; after that I changed one line of code in main.go, 2nd time it took around 1 minute;
but still, one minute is too long for such simple example, is there anyway to make it faster ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

angiglesias picture angiglesias  路  5Comments

LimEJET picture LimEJET  路  6Comments

iMaxopoly picture iMaxopoly  路  3Comments

akhenakh picture akhenakh  路  7Comments

Litarvan picture Litarvan  路  3Comments