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/StbUndoRecord.gen.cs
28 lines | 1.2 KiB | text/x-csharp | CSharpLexer
28 lines | 1.2 KiB | text/x-csharp | CSharpLexer
r505 | using System; | |||
using System.Numerics; | ||||
using System.Runtime.CompilerServices; | ||||
using System.Text; | ||||
namespace ImGuiNET | ||||
{ | ||||
public unsafe partial struct StbUndoRecord | ||||
{ | ||||
public int where; | ||||
public int insert_length; | ||||
public int delete_length; | ||||
public int char_storage; | ||||
} | ||||
public unsafe partial struct StbUndoRecordPtr | ||||
{ | ||||
public StbUndoRecord* NativePtr { get; } | ||||
public StbUndoRecordPtr(StbUndoRecord* nativePtr) => NativePtr = nativePtr; | ||||
public StbUndoRecordPtr(IntPtr nativePtr) => NativePtr = (StbUndoRecord*)nativePtr; | ||||
public static implicit operator StbUndoRecordPtr(StbUndoRecord* nativePtr) => new StbUndoRecordPtr(nativePtr); | ||||
public static implicit operator StbUndoRecord* (StbUndoRecordPtr wrappedPtr) => wrappedPtr.NativePtr; | ||||
public static implicit operator StbUndoRecordPtr(IntPtr nativePtr) => new StbUndoRecordPtr(nativePtr); | ||||
public ref int where => ref Unsafe.AsRef<int>(&NativePtr->where); | ||||
public ref int insert_length => ref Unsafe.AsRef<int>(&NativePtr->insert_length); | ||||
public ref int delete_length => ref Unsafe.AsRef<int>(&NativePtr->delete_length); | ||||
public ref int char_storage => ref Unsafe.AsRef<int>(&NativePtr->char_storage); | ||||
} | ||||
} | ||||