generated from Nexus-Mods/NexusMods.App.Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Nexus-Mods/datoms-rocksdb-rewrite
Rewrite around datom centric code
- Loading branch information
Showing
174 changed files
with
3,062 additions
and
6,459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
benchmarks/NexusMods.EventSourcing.Benchmarks/ABenchmark.cs
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
benchmarks/NexusMods.EventSourcing.Benchmarks/AccumulatorBenchmarks.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using NexusMods.EventSourcing.Benchmarks.Model; | ||
using NexusMods.EventSourcing.DatomStore; | ||
using NexusMods.Paths; | ||
|
||
namespace NexusMods.EventSourcing.Benchmarks; | ||
|
||
public static class AppHost | ||
{ | ||
public static IServiceProvider Create() | ||
{ | ||
var builder = Host.CreateDefaultBuilder() | ||
.ConfigureServices(services => | ||
{ | ||
services.AddDatomStore() | ||
.AddEventSourcing() | ||
.AddFileModel() | ||
.AddSingleton(new DatomStoreSettings() | ||
{ | ||
Path = FileSystem.Shared.GetKnownPath(KnownPath.TempDirectory).Combine(Guid.NewGuid() + ".rocksdb") | ||
}); | ||
}); | ||
|
||
return builder.Build().Services; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
benchmarks/NexusMods.EventSourcing.Benchmarks/Benchmarks/ReadTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using NexusMods.EventSourcing.Abstractions; | ||
using NexusMods.EventSourcing.Benchmarks.Model; | ||
|
||
namespace NexusMods.EventSourcing.Benchmarks.Benchmarks; | ||
|
||
public class ReadTests | ||
{ | ||
private readonly IConnection _connection; | ||
private readonly List<EntityId> _entityIds; | ||
|
||
public ReadTests() | ||
{ | ||
var services = AppHost.Create(); | ||
|
||
_connection = services.GetRequiredService<IConnection>(); | ||
_entityIds = new List<EntityId>(); | ||
} | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
var tx = _connection.BeginTransaction(); | ||
_entityIds.Clear(); | ||
for (var i = 0; i < Count; i++) | ||
{ | ||
var id = Ids.MakeId(Ids.Partition.Entity, (ulong)i); | ||
File.Hash.Assert(tx.TempId(), (ulong)i, tx); | ||
File.Path.Assert(tx.TempId(), $"C:\\test_{i}.txt", tx); | ||
File.Index.Assert(tx.TempId(), (ulong)i, tx); | ||
_entityIds.Add(EntityId.From(id)); | ||
} | ||
tx.Commit(); | ||
} | ||
|
||
|
||
[Params(1, 10, 100, 1000)] | ||
public int Count { get; set; } = 1000; | ||
|
||
[Benchmark] | ||
public int ReadFiles() | ||
{ | ||
var db = _connection.Db; | ||
var read = db.Get<Model.FileReadModel>(_entityIds).ToList(); | ||
return read.Count; | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
benchmarks/NexusMods.EventSourcing.Benchmarks/Benchmarks/WriteTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using NexusMods.EventSourcing.Abstractions; | ||
using NexusMods.EventSourcing.Benchmarks.Model; | ||
|
||
namespace NexusMods.EventSourcing.Benchmarks.Benchmarks; | ||
|
||
public class WriteTests | ||
{ | ||
private readonly IConnection _connection; | ||
|
||
public WriteTests() | ||
{ | ||
var services = AppHost.Create(); | ||
|
||
_connection = services.GetRequiredService<IConnection>(); | ||
} | ||
|
||
|
||
[Params(1, 10, 100, 1000)] | ||
public int Count { get; set; } = 1000; | ||
|
||
[Benchmark] | ||
public void AddFiles() | ||
{ | ||
var tx = _connection.BeginTransaction(); | ||
for (var i = 0; i < Count; i++) | ||
{ | ||
var id = Ids.MakeId(Ids.Partition.Entity, (ulong)i); | ||
File.Hash.Assert(tx.TempId(), (ulong)i, tx); | ||
File.Path.Assert(tx.TempId(), $"C:\\test_{i}.txt", tx); | ||
File.Index.Assert(tx.TempId(), (ulong)i, tx); | ||
} | ||
tx.Commit(); | ||
} | ||
|
||
} |
72 changes: 0 additions & 72 deletions
72
benchmarks/NexusMods.EventSourcing.Benchmarks/EntityContextBenchmarks.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.