KEMBAR78
Calling System.TimeZoneInfo.GetSystemTimeZones() is unacceptable slow calling it the first time. · Issue #8050 · dotnet/android · GitHub
Skip to content

Calling System.TimeZoneInfo.GetSystemTimeZones() is unacceptable slow calling it the first time. #8050

@JeroenBer

Description

@JeroenBer

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

VS 2022 17.5.4

Description

After converting our code from Classic Xamarin to .NET Android we noticed that calling
System.TimeZoneInfo.GetSystemTimeZones() is unacceptable slow the first time. The second time it's fast, probably uses some internal caching.

E.g in fully optimized release mode:
Xamarin: 68ms
.NET Android (.net7.0): 670ms Almost 10 times slower!

In Debug mode the call can even take 4500ms the first time!

This is a problem since we do a lot of timezone conversion also directly after startup and you really notice this hickup from the first call.

Tested it on real device and Emulator Android 13.

Steps to Reproduce

Create a .NET Android app and call:

System.TimeZoneInfo.GetSystemTimeZones()

Notice how slow it is the first time.

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

Area: Mono RuntimeMono-related issues: BCL bugs, AOT issues, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions