nokola
Topic Author
Posts: 188
Joined: 10 Mar 2015, 05:29

Fastest way to load XAML at startup?

02 Mar 2017, 18:06

Trying to optimize startup time and looked at "Loading XAML by code" in the docs here
http://www.noesisengine.com/docs/Gui.Co ... orial.html

Which way is preferred for startup app load: UnityEngine.Resources or preloaded XAMLs in a list in the Settings panel?
 
KeldorKatarn
Posts: 86
Joined: 30 May 2014, 10:26

Re: Fastest way to load XAML at startup?

02 Mar 2017, 18:12

The resources way is specifically for loading stuff that HASN'T been preloaded at startup (for whatever reason, e.g. that it is too big to always be preloaded or such). So for loading at startup, it should be referenced somewhere like the settings list. The resources way is KIND of deprecated anyway. Unity doesn't really recommend that anymore. For loading stuff later they recommend using assetpackages now.
 
nokola
Topic Author
Posts: 188
Joined: 10 Mar 2015, 05:29

Re: Fastest way to load XAML at startup?

03 Mar 2017, 05:26

Thanks! But, for example, if I have 50 XAML-based views of which only one is visible at startup, is it better to put them in the Noesis preload list or better to put just one there and load the rest on demand from Resources?

And yes, it's interesting that Unity doesn't recommend Resources anymore.
 
KeldorKatarn
Posts: 86
Joined: 30 May 2014, 10:26

Re: Fastest way to load XAML at startup?

03 Mar 2017, 06:23

Well it's like any other asset. COnsider memory usage vs performance. If you load stuff later, that will take time. a xaml asset shouldn't exactly take a lot of memory depending on how complicated it is.. but if there's some really complicated stuff in there that's only needed 10% of the time at all... it's the same consideration you'll have with any other asset in Unity.
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Fastest way to load XAML at startup?

03 Mar 2017, 06:29

The recommended approach right now is putting them in the preload list. If you have many XAMLs in that list though you are going to have all the XAMLs source code (the text) in memory. The Resources folder is better in this way because the XAML is only preloaded on demand. But being this way non recommended by Unity we are investigating how to do this using prefabs.
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Fastest way to load XAML at startup?

03 Mar 2017, 06:32

xaml asset shouldn't exactly take a lot of memory depending on how complicated it is..
Yes, that's true. But we should probably compress the content inside the .asset containing the NoesisXaml to improve it. Last time we tried using Gzip Streams in Unity it was really painful and broken.. don't know if this part is better right now.
 
nokola
Topic Author
Posts: 188
Joined: 10 Mar 2015, 05:29

Re: Fastest way to load XAML at startup?

03 Mar 2017, 07:21

Interesting..I don't really care about the memory (max 500K for all XAMLs), mostly concerned with startup performance - will Noesis actually preload all the XAMLs even though I only use one at startup?
 
KeldorKatarn
Posts: 86
Joined: 30 May 2014, 10:26

Re: Fastest way to load XAML at startup?

03 Mar 2017, 22:35

That's UNity workflow, not noesis. If an asset is referenced anywhere it is preloaded. The resources folder is not preloaded. That's true for any asset, not just XAMLs. So if the XAML is referenced in the Noesis settings, it will be preloaded yes.
 
nokola
Topic Author
Posts: 188
Joined: 10 Mar 2015, 05:29

Re: Fastest way to load XAML at startup?

04 Mar 2017, 04:42

I get the part with the Unity loading the XAMLs in memory (probably), however I wonder whether Noesis will parse the XAMLs, instantiate the controls, etc during startup. Ideally that would happen on demand.
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Fastest way to load XAML at startup?

07 Mar 2017, 06:56

Exactly, that only happens on demand. The preload phase only put the XAML text into a memory stream. If you inspect the NoesisXaml class code you will see that we only instantiate the tree when the Load() method is called. Load() is only called manually by the user or when a NoesisView component is attached and needs to be displayed.

Who is online

Users browsing this forum: No registered users and 0 guests