Defer initialization of Application.Properties until first use #671

Merged
merged 1 commit into from Jan 12, 2017

Conversation

Projects
None yet
6 participants
@hartez
Member

hartez commented Jan 10, 2017

Description of Change

Currently the built-in Application.Properties dictionary is initialized as part of the Application constructor, which adds overhead to application startup even if the application doesn't use the feature.

This change defers the initialization of the Properties feature until first use.

No new tests.

Bugs Fixed

  • None

API Changes

  • None

Behavioral Changes

  • Slightly faster application startup
  • Slight delay on first access of Properties

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense
@StephaneDelcroix

Wasn't the initialization already deferred ? You're deferring the creation of the Task, not it's execution

@hartez

This comment has been minimized.

Show comment
Hide comment
@hartez

hartez Jan 11, 2017

Member

@StephaneDelcroix The task starts when GetPropertiesAsync() is called. Accessing .Result doesn't cause the task to start running, it just blocks until the task is complete.

Member

hartez commented Jan 11, 2017

@StephaneDelcroix The task starts when GetPropertiesAsync() is called. Accessing .Result doesn't cause the task to start running, it just blocks until the task is complete.

@rmarinho rmarinho merged commit 32df5c0 into master Jan 12, 2017

6 checks passed

Android-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Tests passed: 351, i…
Details
OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3695, ignored: 10
Details
iOS10-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS10 : Tests passed: 34…
Details
iOS8-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified IOS8 : Tests passed: 344…
Details
iOS9-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS9 : Tests passed: 346…
Details

@hartez hartez deleted the lazy-application-properties branch May 16, 2017

@samhouts samhouts added this to the 2.3.4 milestone Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment