updated readme

This commit is contained in:
Linus Björnstam 2026-04-17 15:05:05 +02:00
parent 0bb8daca1a
commit 662843116e
2 changed files with 160 additions and 19 deletions

View file

@ -64,7 +64,7 @@ public class ImmutableCollectionBenchmarks
// the cost of pure immutable inserts vs your Transient/Builder.
// =========================================================
[Benchmark(Description = "Build: NiceBTree (Transient)")]
[Benchmark(Description = "Build: PersistentMap (Transient)")]
public int Build_NiceBTree()
{
var t = BaseOrderedMap<int, int, IntStrategy>.CreateTransient(_strategy);
@ -72,6 +72,14 @@ public class ImmutableCollectionBenchmarks
return t.Count;
}
[Benchmark(Description = "Build: PersistentMap (Persistent)")]
public int Build_PersistentBTree()
{
var t = PersistentMap<int, int, IntStrategy>.Empty(_strategy);
for (int i = 0; i < N; i++) t.Set(_keys[i], _values[i]);
return t.Count;
}
[Benchmark(Description = "Build: MS Sorted (Builder)")]
public int Build_MsSorted()
{
@ -110,11 +118,9 @@ public class ImmutableCollectionBenchmarks
[Benchmark(Description = "Read: NiceBTree")]
public int Read_NiceBTree()
{
int found = 0;
for (int i = 0; i < N; i++)
{
if (_niceMap.TryGetValue(_keys[i], out _)) found++;
}
var found = 1;
if (_niceMap.TryGetValue(_keys[N/2], out _)) found++;
return found;
}
@ -122,10 +128,8 @@ public class ImmutableCollectionBenchmarks
public int Read_MsSorted()
{
int found = 0;
for (int i = 0; i < N; i++)
{
if (_msSortedMap.ContainsKey(_keys[i])) found++;
}
if (_msSortedMap.ContainsKey(_keys[N/2])) found++;
return found;
}
@ -133,11 +137,9 @@ public class ImmutableCollectionBenchmarks
public int Read_LanguageExt_Map()
{
int found = 0;
for (int i = 0; i < N; i++)
{
// Find returns Option<V>, IsSome checks if it exists
if (_leMap.Find(_keys[i]).IsSome) found++;
}
if (_leMap.Find(_keys[N/2]).IsSome) found++;
return found;
}
@ -145,10 +147,9 @@ public class ImmutableCollectionBenchmarks
public int Read_LanguageExt_HashMap()
{
int found = 0;
for (int i = 0; i < N; i++)
{
if (_leHashMap.Find(_keys[i]).IsSome) found++;
}
if (_leHashMap.Find(_keys[N/2]).IsSome) found++;
return found;
}
@ -216,4 +217,4 @@ public class ImmutableCollectionBenchmarks
{
return _leHashMap.SetItem(_keys[N / 2], -1);
}
}
}