Skip to content

Commit

Permalink
v0.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
oruchreis committed Oct 31, 2024
1 parent 62abaf6 commit c306125
Show file tree
Hide file tree
Showing 35 changed files with 460 additions and 413 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.8] - 2024-10-31
### Changed
- Optimized Reindexer Embedded native libraries for performance.
- Default values of AutoRepair and DisableReplication (ConnectionOptions) are now true for embedded client.
- Namespace closure in Dispose and Stop methods converted to parallel operation.
- Updated benchmark tests.

## [0.4.7] - 2024-10-29
### Added
- More tests
Expand Down
352 changes: 210 additions & 142 deletions README.md

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions Tests/ReindexerNet.EmbeddedBenchmarks/BenchmarkHelper.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using ReindexerNet;
using LiteDB;
using ReindexerNet;
using ReindexerNetBenchmark.EmbeddedBenchmarks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReindexerNetBenchmark;

Expand All @@ -19,6 +15,9 @@ public static object CaptureResult(this BenchmarkRealmEntity entity)
public static object CaptureResult(this IEnumerable<BenchmarkEntity> entites)
=> entites.Select(e => e.PreventLazy()).ToList();

public static object CaptureResult(this ILiteQueryable<BenchmarkEntity> entites)
=> entites.ToEnumerable().Select(e => e.PreventLazy()).ToList();

public static object CaptureResult(this IEnumerable<BenchmarkRealmEntity> entites)
=> entites.Select(e => e.PreventLazy()).ToList();

Expand Down
46 changes: 1 addition & 45 deletions Tests/ReindexerNet.EmbeddedBenchmarks/FodyWeavers.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,7 @@
<xs:complexType>
<xs:all>
<xs:element name="Realm" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="DisableAnalytics" type="xs:boolean">
<xs:annotation>
<xs:documentation>THIS IS DEPRECATED - USE `AnalyticsCollection` INSTEAD. Disables anonymized
usage information from being sent on build. Read more about what data is being collected and
why here: https://github.com/realm/realm-dotnet/blob/main/Realm/Realm.Weaver/Analytics.cs</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="AnalyticsCollection">
<xs:annotation>
<xs:documentation>Controls what anonymized usage information is being sent on build. Read more
about what data is being collected and why here:
https://github.com/realm/realm-dotnet/blob/main/Realm/Realm.Weaver/Analytics/Analytics.cs</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Full">
<xs:annotation>
<xs:documentation>Analytics collection will run normally. This is the default behavior
and we hope you don't change it as the anonymized data collected is critical for
making the right decisions about the future of the Realm SDK.</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="DryRun">
<xs:annotation>
<xs:documentation>Analytics collection will run but will not send it to the server. This
is useful in combination with `AnalyticsLogPath` if you want to review the data being
sent.</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="Disabled">
<xs:annotation>
<xs:documentation>Analytics collection is disabled. No data will be sent on build.</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="AnalyticsLogPath" type="xs:string">
<xs:annotation>
<xs:documentation>Controls where the payload for the anonymized metrics collection will be
stored. This can be useful if you want to review the data being collected by Realm. </xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType></xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
Expand Down
54 changes: 27 additions & 27 deletions Tests/ReindexerNet.EmbeddedBenchmarks/InsertBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public CustomCategoryDiscovererAttribute()
protected ILiteCollection<BenchmarkEntity> _liteCollMemory;
protected Server.Server _caServer;
protected Connector? _caConnector;
protected Connector? _caConnectorCompressed;
//protected Connector? _caConnectorCompressed;
protected Connector _caMemoryConnector;
protected Realm _realm;

Expand Down Expand Up @@ -145,7 +145,7 @@ public virtual void CachalotSetup()
_caServer = new Server.Server(new NodeConfig { DataPath = Path.Combine(_dataPath, "Cachalot"), IsPersistent = true, ClusterName = "Cachalot" });
_caConnector = new Connector(new ClientConfig { IsPersistent = true });
_caConnector.DeclareCollection<BenchmarkEntity>("BenchmarkEntity");
_caConnector.GetCollectionSchema("BenchmarkEntity").UseCompression = false;
//_caConnector.GetCollectionSchema("BenchmarkEntity").UseCompression = false;
}

[IterationCleanup(Targets = new[] { nameof(Cachalot) })]
Expand All @@ -156,25 +156,25 @@ public void CachalotClean()
Cleanup();
}

[IterationSetup(Targets = new[] { nameof(CachalotCompressed) })]
public virtual void CachalotCompressedSetup()
{
Setup();
Directory.CreateDirectory(Path.Combine(_dataPath, "CachalotCompressed"));
_caServer?.Stop();
_caServer = new Server.Server(new NodeConfig { DataPath = Path.Combine(_dataPath, "CachalotCompressed"), IsPersistent = true, ClusterName = "CachalotCompressed" });
_caConnectorCompressed = new Connector(new ClientConfig { IsPersistent = true });
_caConnectorCompressed.DeclareCollection<BenchmarkEntity>("BenchmarkEntity");
_caConnectorCompressed.GetCollectionSchema("BenchmarkEntity").UseCompression = true;
}

[IterationCleanup(Targets = new[] { nameof(CachalotCompressed) })]
public void CachalotCompressedClean()
{
_caConnectorCompressed!.Dispose();
_caServer.Stop();
Cleanup();
}
//[IterationSetup(Targets = new[] { nameof(CachalotCompressed) })]
//public virtual void CachalotCompressedSetup()
//{
// Setup();
// Directory.CreateDirectory(Path.Combine(_dataPath, "CachalotCompressed"));
// _caServer?.Stop();
// _caServer = new Server.Server(new NodeConfig { DataPath = Path.Combine(_dataPath, "CachalotCompressed"), IsPersistent = true, ClusterName = "CachalotCompressed" });
// _caConnectorCompressed = new Connector(new ClientConfig { IsPersistent = true });
// _caConnectorCompressed.DeclareCollection<BenchmarkEntity>("BenchmarkEntity");
// _caConnectorCompressed.GetCollectionSchema("BenchmarkEntity").UseCompression = true;
//}

//[IterationCleanup(Targets = new[] { nameof(CachalotCompressed) })]
//public void CachalotCompressedClean()
//{
// _caConnectorCompressed!.Dispose();
// _caServer.Stop();
// Cleanup();
//}

[IterationSetup(Targets = new[] { nameof(CachalotOnlyMemory) })]
public virtual void CachalotOnlyMemorySetup()
Expand Down Expand Up @@ -269,12 +269,12 @@ public virtual void Cachalot()
entities.PutMany(_data);
}

[Benchmark]
public virtual void CachalotCompressed()
{
var entities = _caConnectorCompressed!.DataSource<BenchmarkEntity>("BenchmarkEntity");
entities.PutMany(_data);
}
//[Benchmark]
//public virtual void CachalotCompressed()
//{
// var entities = _caConnectorCompressed!.DataSource<BenchmarkEntity>("BenchmarkEntity");
// entities.PutMany(_data);
//}

[Benchmark]
public virtual void CachalotOnlyMemory()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.11" />
<PackageReference Include="Cachalot.Client" Version="2.0.8" />
<PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Cachalot.Client" Version="2.5.13" />
<PackageReference Include="LiteDB" Version="5.0.21" />
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="Realm" Version="11.6.1" />
<PackageReference Include="SpanJson" Version="4.0.1" />
<PackageReference Include="Realm" Version="20.0.0" />
<PackageReference Include="SpanJson" Version="4.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
51 changes: 24 additions & 27 deletions Tests/ReindexerNet.EmbeddedBenchmarks/SelectArrayMultiple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,28 @@ public class SelectArrayMultiple : SelectBenchmarkBase
return result;
}

[Benchmark]
public IList<object?> CachalotCompressed()
{
var result = new List<object?>
{
CaDSCompressed.Where(IntAnyQuery).AsEnumerable().CaptureResult(),
CaDSCompressed.Where(StrAnyQuery).AsEnumerable().CaptureResult(),
CaDSCompressed.Where(IntAllQuery).AsEnumerable().CaptureResult(),
CaDSCompressed.Where(StrAllQuery).AsEnumerable().CaptureResult()
};
return result;
}
//[Benchmark]
//public IList<object?> CachalotCompressed()
//{
// var result = new List<object?>
// {
// CaDSCompressed.Where(IntAnyQuery).AsEnumerable().CaptureResult(),
// CaDSCompressed.Where(StrAnyQuery).AsEnumerable().CaptureResult(),
// CaDSCompressed.Where(IntAllQuery).AsEnumerable().CaptureResult(),
// CaDSCompressed.Where(StrAllQuery).AsEnumerable().CaptureResult()
// };
// return result;
//}

[Benchmark]
public IList<object?> LiteDb()
{
var result = new List<object?>
{
LiteColl.Query().Where(IntAnyQuery).ToEnumerable().CaptureResult(),
LiteColl.Query().Where(StrAnyQuery).ToEnumerable().CaptureResult(),
LiteColl.Query().Where(IntAllQuery).ToEnumerable().CaptureResult(),
LiteColl.Query().Where(StrAllQuery).ToEnumerable().CaptureResult()
LiteColl.Query().Where(IntAnyQuery).CaptureResult(),
LiteColl.Query().Where(StrAnyQuery).CaptureResult(),
LiteColl.Query().Where(IntAllQuery).CaptureResult(),
LiteColl.Query().Where(StrAllQuery).CaptureResult()
};
return result;
}
Expand All @@ -103,26 +103,23 @@ public class SelectArrayMultiple : SelectBenchmarkBase
{
var result = new List<object?>
{
LiteCollMemory.Query().Where(IntAnyQuery).ToEnumerable().CaptureResult(),
LiteCollMemory.Query().Where(StrAnyQuery).ToEnumerable().CaptureResult(),
LiteCollMemory.Query().Where(IntAllQuery).ToEnumerable().CaptureResult(),
LiteCollMemory.Query().Where(StrAllQuery).ToEnumerable().CaptureResult()
LiteCollMemory.Query().Where(IntAnyQuery).CaptureResult(),
LiteCollMemory.Query().Where(StrAnyQuery).CaptureResult(),
LiteCollMemory.Query().Where(IntAllQuery).CaptureResult(),
LiteCollMemory.Query().Where(StrAllQuery).CaptureResult()
};
return result;
}

[Benchmark]
public IList<object?> Realm()
{



var result = new List<object?>
{
RealmCli.All<BenchmarkRealmEntity>().Filter($"ANY IntArray.@values IN {{ {SearchItemsIntJoined} }}").CaptureResult(),
RealmCli.All<BenchmarkRealmEntity>().Filter($"ANY StrArray.@values IN {{ {SearchItemsStrJoined} }}").CaptureResult(),
RealmCli.All<BenchmarkRealmEntity>().Filter($"ALL IntArray.@values IN {{ {SearchItemsIntJoined} }}").CaptureResult(),
RealmCli.All<BenchmarkRealmEntity>().Filter($"ALL StrArray.@values IN {{ {SearchItemsStrJoined} }}").CaptureResult()
RealmCli.All<BenchmarkRealmEntity>().Filter($"ANY IntArray IN {{ {SearchItemsIntJoined} }}").CaptureResult(), //.@values
RealmCli.All<BenchmarkRealmEntity>().Filter($"ANY StrArray IN {{ {SearchItemsStrJoined} }}").CaptureResult(),
RealmCli.All<BenchmarkRealmEntity>().Filter($"ALL IntArray IN {{ {SearchItemsIntJoined} }}").CaptureResult(),
RealmCli.All<BenchmarkRealmEntity>().Filter($"ALL StrArray IN {{ {SearchItemsStrJoined} }}").CaptureResult()
};

return result;
Expand Down
35 changes: 18 additions & 17 deletions Tests/ReindexerNet.EmbeddedBenchmarks/SelectArraySingle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,26 @@ public class SelectArraySingle: SelectBenchmarkBase
return result;
}

[Benchmark]
public IList<object?> CachalotCompressed()
{
var nstr = N.ToString();
var result = new List<object?>
{
CaDSCompressed.Where(e => e.IntArray.Contains(N)).AsEnumerable().CaptureResult(),
CaDSCompressed.Where(e => e.StrArray.Contains(nstr)).AsEnumerable().CaptureResult(),
};
return result;
}
//[Benchmark]
//public IList<object?> CachalotCompressed()
//{
// var nstr = N.ToString();
// var result = new List<object?>
// {
// CaDSCompressed.Where(e => e.IntArray.Contains(N)).AsEnumerable().CaptureResult(),
// CaDSCompressed.Where(e => e.StrArray.Contains(nstr)).AsEnumerable().CaptureResult(),
// };
// return result;
//}

[Benchmark]
public IList<object?> LiteDb()
{
var nstr = N.ToString();
var result = new List<object?>
{
LiteColl.Query().Where(e => e.IntArray.Contains(N)).ToEnumerable().CaptureResult(),
LiteColl.Query().Where(e => e.StrArray.Contains(nstr)).ToEnumerable().CaptureResult(),
LiteColl.Query().Where(e => e.IntArray.Contains(N)).CaptureResult(),
LiteColl.Query().Where(e => e.StrArray.Contains(nstr)).CaptureResult(),
};
return result;
}
Expand All @@ -94,19 +94,20 @@ public class SelectArraySingle: SelectBenchmarkBase
var nstr = N.ToString();
var result = new List<object?>
{
LiteCollMemory.Query().Where(e => e.IntArray.Contains(N)).ToEnumerable().CaptureResult(),
LiteCollMemory.Query().Where(e => e.StrArray.Contains(nstr)).ToEnumerable().CaptureResult(),
LiteCollMemory.Query().Where(e => e.IntArray.Contains(N)).CaptureResult(),
LiteCollMemory.Query().Where(e => e.StrArray.Contains(nstr)).CaptureResult(),
};
return result;
}

[Benchmark]
public IList<object?> Realm()
{
var nstr = N.ToString();
var result = new List<object?>
{
RealmCli.All<BenchmarkRealmEntity>().Filter("ANY IntArray.@values == $0", N).CaptureResult(),
RealmCli.All<BenchmarkRealmEntity>().Filter("ANY StrArray.@values == $0", N.ToString()).CaptureResult()
RealmCli.All<BenchmarkRealmEntity>().Filter("ANY IntArray == $0", N).CaptureResult(),
RealmCli.All<BenchmarkRealmEntity>().Filter("ANY StrArray == $0", N.ToString()).CaptureResult()
};

return result;
Expand Down
Loading

0 comments on commit c306125

Please sign in to comment.