How to reduce the building time for a Qt program - qt

I have a Qt project which will take around 15 mins to build the program. Each time when I make a small modification I have to wait for long time.
Is there a method to reduce this build time? Or is there a way to "make only the file which I had modified" and then execute the program?

Well check whether your are rebuilding in all your program runs. And also whether you are cleaning your project before running it. Because if you do so, it have to regenerate all those moc files and output[.o] files needed for execution.
But normally upon a small change, the build doesn't take too much time. I have been developing a project by qt creator, it doesn't take too much time while building upon a small modification. But if there is clean/rebuild step while every execution, it will definitely take whole build time. And again even if you manually build your project via terminal without the help of IDE, it won't take that much time provided you don't remove the moc files and .o files manually before building after small modifcation.

If you are using qrc in your app and there are many files in it, it takes too much time to generate qrc.cpp and qrc.obj files. So try to minimize the number of files in qrc system and also try to minimize the sizes of each file.

As far as I know, usage of precompiled headers may help, but effect of that may varay according to you program structure.

The general C++ ways to reduce compile time apply. Don't #include what you don't need. Use class declarations instead of #include'ing the definitions if possible. etc.

It depends where you do that small modification: if you modify something in a header that is included pretty much in every file in your project...
Additionally to above responses, if you work with linux, check out ccache (https://ccache.samba.org/)

Related

Efficient way to use PyInstaller

I'm producing an .exe file via PyInstaller and I wonder whether there is a specific option or similar to do so while iterating through some changes. For example, I add a simple print statement in the entire code, do I always have to go through the whole building stage of the .exe file?
I'm asking because it takes a while just to try something out. In my case I think it takes between 5-10 min to create the .exe. In general it's ok but when you do that a dozens or more times a day it adds up.

How to "Automatically" test my Entity without .vwf/.bdf files

I am writing in VHDL (at Quartus II Web Edition [Software v9.1 Service Pack 2]) for a project of mine and I encountered a problem.
I have created a large decoder which I would like to test but not via creating a .bdf file and then adding a vector waveform file on it.
For the needs of this testing I have made a Python script to create .txt files with the proper 32bit vectors on it and then I am inserting them (c/p) to the .vwf file. Finally I do a timing simulation and then observe the outputs if they are the correct ones or not...but this is really time consuming and I think there is probably a better way to do it.
Or should I add the pain of converting by hand the 32bit values to integers to see that they are the ones expected after testing.
So, is there a faster/easier way to do it?
Thanks in advance!

what is the fastest way to get all attributes from a class?

I'm working in a tool that is supposed to generate some Java Code to accelerate part of the development based in a swing input dialog...there is no need to get any further with it so I'm going to my problem...
I need to retrieve all the attributes from a class to check whenever it is necessary to add a new one. I tried to use reflection but things started getting complicated. In order to use reflection I need to compile the class I want to get the attributes as it does not work directly from .java file, .class is required for it.
The problem is that many of the classes has a lot of dependencies! Due to some design flaws some classes are a high coupled, so if I am supposed to dynamic use a class loader to compile a class A I would have to retrieve and compile all its dependencies! And then retrieve all the possible dependencies from the class A dependency classes!
I made a test running an existing ant file to compile to whole project instead of the above approach but it takes about 9 minutes to finish! From the final user perspective waiting 9 minutes every run is not accetable!
Does any one here knows a better solution???
If you want to avoid working with reflection and bytecode, it means that you will have to parse the .java files yourself with a grammar and, well, a parser based on this grammar. It is possible (especially if you do not implement the whole grammar, because many java features might be useless in your project perimeter), but I reckon this is no easy task.
There is an Apache commons Sandbox package called ClassScan. It is capable of doing the kind of source parsing you appear to require. http://commons.apache.org/sandbox/commons-classscan/. Note that it is in the Sandbox, so not part of the Commons Proper.

Ui forms: Add runtime or compile time?

I want to know which way is efficient if I am having number of UI forms. I don have any idea about memory utilization in both of case I just tried both ways in a simple example.
http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html here they described both ways. Now which one method is more efficient?
The prefered way to use ui files is to compile them with the uic. QtCreator will automatically take care of this.
You can use the QUiLoader if you have special constraints - for example if you want to load a customized ui without the need to recompile your program.
In terms of memory usage you should not notice any difference. Both instanciate the same classes. Of course the time to read/parse/generate code is needed at compile or at runtime.
I would say that in a normal application this is rather insignificant since a user interaction is needed to change the form of a application, but I have never benchmarked this.

Flex unzip/uncompress huge files

I am having an AIR applicaiton which is supposed to uncompress the file of huge size (>1GB)
I tried commonly discussed utilities i.e. FZip nochump and few more
I face the same problem with all of them,
They tyr to unzip the entire file in the memory (using ByteArray.defalte method)
This works well with the files of small size howevre they just hang the applicaiton if the size of the file is big (>1GB)
Any suggestions?
Is there not a way you could use file spanning similar to the RAR formats. I think 7-Zip's 7Z supports it also. Depending on how to the decompression library is implemented, file spanning could reduce the memory usage theoretically.
Try looking into using the LZMA SDK a la 7-Zip:
http://www.7-zip.org/sdk.html
Maybe there's Flex bindings.
I agree with sammy, Air it's not the best solution for a task like that, IMHO it's better to include in your distribution a native utility to expand your files (remember that you need an utility for each platform that you want to support) then use the new Air2 API to invoke them. Doing this way the expansion of the archive is done in a separate process without freezing your app.
Maybe you can boundle just one utility if you are sure that every platform has a common runtime (ex. java).

Resources