speedups maybe

changed Set function and Find(routing)Index) to specialize on class (no
virtual dispatch) or using generics.
This commit is contained in:
Linus Björnstam 2026-05-21 12:29:20 +02:00
parent a2458e727a
commit 7ee2238248
2 changed files with 21 additions and 18 deletions

View file

@ -31,6 +31,9 @@ where TStrategy : IKeyStrategy<K>
// Fixed-size buffer for the path.
// Depth 16 * 32 (branching factor) = Exabytes of capacity.
// The B tree is, theoretically, not limited by the size of an int, like
// all int-indexed data structures (or bit partitioned ones).
// This should be enough for anyone.
[InlineArray(16)]
internal struct IterNodeBuffer<K>
{
@ -138,7 +141,7 @@ public struct BTreeEnumerator<K, V, TStrategy> : IEnumerator<KeyValuePair<K, V>>
// Find index in Leaf
_currentLeaf = node.AsLeaf<V>();
int index = BTreeFunctions.FindIndex<K, TStrategy>(_currentLeaf, key, keyPrefix, _strategy);
int index = BTreeFunctions.FindIndex<K,V, TStrategy>(_currentLeaf, key, keyPrefix, _strategy);
// Set position to (index - 1) so that the first MoveNext() lands on 'index'
_currentLeafIndex = index - 1;