View Issue Details

IDProjectCategoryView StatusLast Update
0001558NoesisGUIUnity3Dpublic2019-10-04 16:51
ReporternokolaAssigned Tosfernandez 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version2.2.5 
Target Version2.3.0Fixed in Version2.3.0 
Summary0001558: Performance regression: RegisterNativeTypes takes 0.5 seconds on newer 8-core phone
DescriptionAndroid:
In Assets\NoesisGUI\Plugins\API\Core\Extend.cs, Init(), the RegisterNativeTypes() code takes 0.5 seconds on xiaomi redmi note 7 phone:
            long start = DateTime.Now.Ticks;
            RegisterNativeTypes();
            Debug.Log("RegisterNativeTypes: " + (DateTime.Now.Ticks - start) / 10_000);

This (perhaps...or maybe something else) makes a noticeable glitch during app load on Android compared to 2.2.4. I suspect Noesis.Gui.Init() gets called too early or there's more code in RegisterNativeTypes(). Could be something else.

I expect on slower phones the cost of RegisterNativeTypes() to be significantly higher (second or two.)
On my PC the cost is ~240ms Core i7.
Steps To ReproduceAdd this code to Assets\NoesisGUI\Plugins\API\Core\Extend.cs, Init(), the RegisterNativeTypes() code takes 0.5 seconds on xiaomi redmi note 7 phone:
            long start = DateTime.Now.Ticks;
            RegisterNativeTypes();
            Debug.Log("RegisterNativeTypes: " + (DateTime.Now.Ticks - start) / 10_000);

Run on Android and check logcat
TagsUnity
PlatformAny

Activities

sfernandez

sfernandez

2019-10-03 11:18

manager   ~0005975

Hi,

I've been doing some tests with our samples, comparing 2.2.4 with 2.2.5 version and there is no difference with respect to that function.
The times are the same, around 700ms in a Nexus 5X, and 300ms in first generation Core i7 PC.
What numbers did you get with 2.2.4 compared to 2.2.5? Could you please use Stopwatch to do those measurements?

Those numbers are terrible, though, and it is something we should investigate.
nokola

nokola

2019-10-03 17:31

reporter   ~0005976

You're right - 2.2.4 is similar timing regarding the RegisterNativeTypes() function. Maybe there's slowdown somewhere else, or I'm making it up. I've noticed a longer black screen after installing 2.2.5, then profiled in Editor and found RegisterNativeTypes() taking a significant time. That's when I assumed it was this function responsible (because I haven't seen it show up in profiling before, thus assumed it's regression without further testing.)

I tried profiling startup time on Android device with Unity 2018.4.10f. Unfortunately, Unity uses ~5GB of RAM for the first 2-3 seconds of the app and crashes. I haven't been able to pinpoint what's the "hot path" on Android device yet. I can only profile in Editor currently, which makes it harder to trace function calls, also much faster on PC than phone.

If you can get profiling on device, and see if there's another hot path during startup that will be awesome. I'll try something with the native Android profilers (not through Unity.)
Sorry no specific info at the moment (apart from the function above!)
nokola

nokola

2019-10-03 17:54

reporter   ~0005977

I did some more testing - there seems to be *no* performance regression during startup from 2.2.4 to 2.2.5.
Not sure why RegisterNativeTypes() started showing up - maybe because I updated to new Unity (from 2017 to 2018) and profiler started showing more info.

Either way, reducing cost for RegisterNativeTypes() startup will be a very good win! :)
sfernandez

sfernandez

2019-10-04 11:30

manager   ~0005978

Last edited: 2019-10-04 11:32

View 2 revisions

Great to know there is no performance regression on your side either... from our latest changes I couldn't figure out anything affecting startup times.

Regarding RegisterNativeTypes() we found an alternative implementation that will dramatically reduce the loading times (in PC from 300ms to 20ms approx.).
It will be included in our next version.

nokola

nokola

2019-10-04 16:51

reporter   ~0005979

Nice! Also good job on speeding up the release cadence - it's good to see smaller but more often version releases!

Issue History

Date Modified Username Field Change
2019-10-03 06:30 nokola New Issue
2019-10-03 06:30 nokola Tag Attached: Unity
2019-10-03 09:42 sfernandez Assigned To => sfernandez
2019-10-03 09:42 sfernandez Status new => assigned
2019-10-03 11:18 sfernandez Status assigned => feedback
2019-10-03 11:18 sfernandez Note Added: 0005975
2019-10-03 17:31 nokola Note Added: 0005976
2019-10-03 17:31 nokola Status feedback => assigned
2019-10-03 17:54 nokola Note Added: 0005977
2019-10-04 11:30 sfernandez Note Added: 0005978
2019-10-04 11:32 sfernandez Note Edited: 0005978 View Revisions
2019-10-04 12:29 sfernandez Status assigned => resolved
2019-10-04 12:29 sfernandez Fixed in Version => 2.3.0
2019-10-04 12:29 sfernandez Target Version => 2.3.0
2019-10-04 16:51 nokola Status resolved => closed
2019-10-04 16:51 nokola Resolution open => fixed
2019-10-04 16:51 nokola Note Added: 0005979