memory usage - Conditionally allocate prefix buffers in `LeafNode` and introduce `PrefixInternalNode` to reduce memory overhead when prefixes are disabled. - Bypass prefix calculation and logic entirely when `UsesPrefixes` is false. - Add a binary search fallback for key scanning. - Implement a dedicated `int` scanning fast-path, removing SIMD prefix usage from `IntStrategy`. - Reorganize key strategies into separate files. - Add a new benchmark project specifically for string keys.
16 lines
457 B
C#
16 lines
457 B
C#
namespace PersistentMap;
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
public struct IntStrategy : IKeyStrategy<int>
|
|
{
|
|
public bool UsesPrefixes => false;
|
|
public bool IsLossless => true;
|
|
public bool UseBinarySearch => false;
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public int Compare(int x, int y) => x.CompareTo(y);
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public long GetPrefix(int key) => 0; // Unused
|
|
}
|