Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Performance] Allow manual initialization of expensive operations to potentially decrease startup time #5248

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove some stuff
  • Loading branch information
kingces95 committed Apr 18, 2019
commit 3b6ae7c2672c1e1047c02523650695c17387b7cc
2 changes: 1 addition & 1 deletion Xamarin.Forms.Build
5 changes: 3 additions & 2 deletions Xamarin.Forms.Core/Profiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
using System.Threading.Tasks;
using Xamarin.Forms.Internals;

#if false
namespace Xamarin.Forms.Internals
{
#if false
[EditorBrowsable(EditorBrowsableState.Never)]
public struct Profile : IDisposable
{
Expand Down Expand Up @@ -144,5 +144,6 @@ public void Dispose()
Data[_slot] = datum;
}
}
#endif
}
#endif

11 changes: 5 additions & 6 deletions Xamarin.Forms.Core/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using Xamarin.Forms.Internals;
//using Xamarin.Forms.Internals;

namespace Xamarin.Forms
{
Expand Down Expand Up @@ -252,7 +252,7 @@ static Registrar()
//typeof(ExportRendererAttribute);
//typeof(ExportCellAttribute);
//typeof(ExportImageSourceHandlerAttribute);
public static void RegisterRenderers(HandlerAttribute[] attributes)
private static void RegisterRenderers(HandlerAttribute[] attributes)
{
var length = attributes.Length;
for (var i = 0; i < length; i++)
Expand All @@ -263,7 +263,7 @@ public static void RegisterRenderers(HandlerAttribute[] attributes)
}
}

public static void RegisterStylesheets()
private static void RegisterStylesheets()
{
var assembly = typeof(StyleSheets.StylePropertyAttribute).GetTypeInfo().Assembly;

Expand All @@ -283,7 +283,7 @@ public static void RegisterStylesheets()
}
}

public static void RegisterEffects(string resolutionName, ExportEffectAttribute[] effectAttributes)
private static void RegisterEffects(string resolutionName, ExportEffectAttribute[] effectAttributes)
{
var exportEffectsLength = effectAttributes.Length;
for (var i = 0; i < exportEffectsLength; i++)
Expand All @@ -297,8 +297,7 @@ public static void RegisterEffects(string resolutionName, ExportEffectAttribute[
{
//Profile.FrameBegin();

Assembly[] assemblies;
assemblies = Device.GetAssemblies();
Assembly[] assemblies = Device.GetAssemblies();

if (ExtraAssemblies != null)
assemblies = assemblies.Union(ExtraAssemblies).ToArray();
Expand Down
46 changes: 23 additions & 23 deletions Xamarin.Forms.Platform.Android/Forms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static void Init(Context activity, Bundle bundle, Assembly resourceAssemb
//Profile.FrameEnd();
}

public static void Init(ActivationOptions activation)
public static void Initialize(ActivationOptions activation)
{
//Profile.FrameBegin();
SetupInit(
Expand Down Expand Up @@ -264,28 +264,28 @@ static void SetupInit(Context activity, Assembly resourceAssembly, ActivationOpt
{
if (maybeOptions.HasValue)
{
var options = maybeOptions.Value;
var handlers = options.Handlers;
var flags = options.Flags;
var effectScopes = options.EffectScopes;

// renderers
Registrar.RegisterRenderers(handlers);

// effects
if (effectScopes != null)
{
for (var i = 0; i < effectScopes.Length; i++)
{
var effectScope = effectScopes[0];
Registrar.RegisterEffects(effectScope.Name, effectScope.Effects);
}
}

// css
var noCss = (flags & ActivationFlags.NoCss) != 0;
if (!noCss)
Registrar.RegisterStylesheets();
//var options = maybeOptions.Value;
//var handlers = options.Handlers;
//var flags = options.Flags;
//var effectScopes = options.EffectScopes;

//// renderers
//Registrar.RegisterRenderers(handlers);

//// effects
//if (effectScopes != null)
//{
// for (var i = 0; i < effectScopes.Length; i++)
// {
// var effectScope = effectScopes[0];
// Registrar.RegisterEffects(effectScope.Name, effectScope.Effects);
// }
//}

//// css
//var noCss = (flags & ActivationFlags.NoCss) != 0;
//if (!noCss)
// Registrar.RegisterStylesheets();
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.Android/PlatformRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Android.Content;
using Android.Views;
using Android.Widget;
using Xamarin.Forms.Internals;
//using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Platform.Android
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

namespace Xamarin.Forms.Platform.Android
{
public class OpenGLViewRenderer : ViewRenderer<OpenGLView, GLSurfaceView>
//public class OpenGLViewRenderer : ViewRenderer<OpenGLView, GLSurfaceView>
internal class OpenGLViewRenderer : ViewRenderer<OpenGLView, GLSurfaceView>
{
bool _disposed;

Expand Down