|
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
- using HarmonyLib;
-
- #if DEBUG
- namespace CLre.Fixes
- {
- public class StartupSpeedup
- {
-
- }
-
- [HarmonyPatch(typeof(FrontEnd.FrontEndContextRoot), "WaitForFrameworkInitialization")]
- //[HarmonyPatch]
- class Speedup_Benchmark3
- {
- internal static Stopwatch test = null;
-
- public static void Prefix()
- {
- test = Stopwatch.StartNew();
- }
- }
-
- [HarmonyPatch(typeof(FrontEnd.MainFrontEnd), "RequestPlayerId")]
- //[HarmonyPatch]
- class Speedup_Benchmark
- {
- internal static Stopwatch test = null;
-
- public static void Prefix()
- {
- test.Stop();
- long elapsed = test.ElapsedMilliseconds;
- API.Utility.Logging.Log($"OnContextInitialized completed in ~{elapsed}ms");
- }
- }
-
- [HarmonyPatch(typeof(FrontEnd.MainFrontEnd), "RegisterCustomHtmlElementTypes")]
- class Speedup_Benchmark2
- {
-
- public static void Prefix()
- {
- if (Speedup_Benchmark3.test != null)
- {
- Speedup_Benchmark3.test.Stop();
- long elapsed = Speedup_Benchmark3.test.ElapsedMilliseconds;
- API.App.Client.LogInitComplete += (_, __) =>
- {
- API.Utility.Logging.Log($"Scene loaded in ~{elapsed}ms");
- };
- }
- Speedup_Benchmark.test = Stopwatch.StartNew();
- }
- }
- }
- #endif
|