Show More
Commit Description:
Optimize PreserveCounts and only recalculate when needed....
Commit Description:
Optimize PreserveCounts and only recalculate when needed.
Previously would recalculate preservecounts every Update call (~1 per frame), which isn't necessary
when there's no tick. Might be some room to tweak, like doing these updates only when preserves change.
Some measurements: This takes about 30ms versus the .25 ms with no preserve (then like .0002ms).
When the map is filled up with preserve, about 35ms and 9ms. With a handful of
cells, it's more like 0.8ms (before JIT optimizes most of it away).
References:
File last commit:
Show/Diff file:
Action:
ImGui.NET/Generated/ImGuiPlatformMonitor.gen.cs
34 lines | 1.6 KiB | text/x-csharp | CSharpLexer
34 lines | 1.6 KiB | text/x-csharp | CSharpLexer
r16 | using System; | |||
using System.Numerics; | ||||
using System.Runtime.CompilerServices; | ||||
using System.Text; | ||||
namespace ImGuiNET | ||||
{ | ||||
public unsafe partial struct ImGuiPlatformMonitor | ||||
{ | ||||
public Vector2 MainPos; | ||||
public Vector2 MainSize; | ||||
public Vector2 WorkPos; | ||||
public Vector2 WorkSize; | ||||
public float DpiScale; | ||||
} | ||||
public unsafe partial struct ImGuiPlatformMonitorPtr | ||||
{ | ||||
public ImGuiPlatformMonitor* NativePtr { get; } | ||||
public ImGuiPlatformMonitorPtr(ImGuiPlatformMonitor* nativePtr) => NativePtr = nativePtr; | ||||
public ImGuiPlatformMonitorPtr(IntPtr nativePtr) => NativePtr = (ImGuiPlatformMonitor*)nativePtr; | ||||
public static implicit operator ImGuiPlatformMonitorPtr(ImGuiPlatformMonitor* nativePtr) => new ImGuiPlatformMonitorPtr(nativePtr); | ||||
public static implicit operator ImGuiPlatformMonitor* (ImGuiPlatformMonitorPtr wrappedPtr) => wrappedPtr.NativePtr; | ||||
public static implicit operator ImGuiPlatformMonitorPtr(IntPtr nativePtr) => new ImGuiPlatformMonitorPtr(nativePtr); | ||||
public ref Vector2 MainPos => ref Unsafe.AsRef<Vector2>(&NativePtr->MainPos); | ||||
public ref Vector2 MainSize => ref Unsafe.AsRef<Vector2>(&NativePtr->MainSize); | ||||
public ref Vector2 WorkPos => ref Unsafe.AsRef<Vector2>(&NativePtr->WorkPos); | ||||
public ref Vector2 WorkSize => ref Unsafe.AsRef<Vector2>(&NativePtr->WorkSize); | ||||
public ref float DpiScale => ref Unsafe.AsRef<float>(&NativePtr->DpiScale); | ||||
public void Destroy() | ||||
{ | ||||
ImGuiNative.ImGuiPlatformMonitor_destroy((ImGuiPlatformMonitor*)(NativePtr)); | ||||
} | ||||
} | ||||
} | ||||