PersistentMap/PersistentMap/KeyStrategies/IntStrategy.cs
Linus Björnstam 9242c1c751 perf: Optimize non-prefix key strategies and
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.
2026-04-22 15:55:33 +02:00

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
}