Page 1 of 1
It's too slow because using layout to create window
Posted: Wed Nov 13, 2013 12:31
by silentyears
Hi, here is my question.
Every time i run my app, it will use too much time to start because i using .layout file to create GUI windows and there are a lot of windows, so is there any good advice or clever way to solove it ?
Thank you very much!
Re: It's too slow because using layout to create window
Posted: Mon Nov 18, 2013 14:40
by mmixLinus
Hi silentyears
I have the same "problem", but it is probably mostly due to a design choice I made early in
my project. It loads the layouts, and creates quite a few windows, most of which I don't actually need right at startup..
Eventually, I will solve this by creating the windows when they are needed.
I haven't looked into putting the layouts into a compressed file, but this might help a bit.
/mmixLinus
Re: It's too slow because using layout to create window
Posted: Tue Nov 19, 2013 11:31
by silentyears
mmixLinus wrote:Hi silentyears
I have the same "problem", but it is probably mostly due to a design choice I made early in
my project. It loads the layouts, and creates quite a few windows, most of which I don't actually need right at startup..
Eventually, I will solve this by creating the windows when they are needed.
I haven't looked into putting the layouts into a compressed file, but this might help a bit.
/mmixLinus
thank you! and what do you mean to put the layouts into compressed file and how?
Re: It's too slow because using layout to create window
Posted: Tue Nov 19, 2013 12:07
by Kulik
Use rapidxml, be smart about layouts. Loading everything up front and reusing will increasing responsiveness (by getting rid of any stalls), lazy loading will make it start quickly but stall when a new layout has to be loaded.
There are many general programming solutions to this but in the end you have to load the layouts, it's going to take time...
Not sure what to advice here, the question isn't clear enough.
Re: It's too slow because using layout to create window
Posted: Thu Dec 19, 2013 21:44
by KishukuOni
For us the slowdown was more in creating all the windows, not parsing the xml. Regardless, we now load in stages.
We load one layout at start-up. This is a simple loading screen layout with a progress bar, a fancy background, and some text.
Then we show that screen while we load the main menu and a few other layouts needed there. Then when the user starts a game it loads the rest of the game files, graphics, and the rest of the layouts. (showing a loading screen once again).
This makes getting to the main menu still pretty quick, plus there is no blank empty screen at startup. I feel like this is how many mainstream games work and users expect this kind of behavior.