Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
df0e2ba
RESPite, squashed
mgravell Aug 29, 2025
818f5e3
testing setup
mgravell Aug 29, 2025
7fc7910
intermediate, builds (only)
mgravell Aug 29, 2025
752ec80
parsers: bool and ResponseSummary
mgravell Aug 29, 2025
e307d6e
unifying tests
mgravell Aug 30, 2025
fd00c0e
Move to RespConnection (base class); compiles only
mgravell Aug 30, 2025
38cd9bb
Clarify whether WithCancellationToken means "instead of" vs "as well …
mgravell Aug 30, 2025
8dca0e0
nit
mgravell Aug 30, 2025
9f510f6
answered own question
mgravell Aug 30, 2025
87f0769
docs
mgravell Aug 30, 2025
e43419e
words
mgravell Aug 30, 2025
3d7919c
formatting
mgravell Aug 30, 2025
a0cc13e
more words
mgravell Aug 30, 2025
9bdde8b
I need to disable ctrl+shift+s in md files
mgravell Aug 30, 2025
e9f78a3
unit tests
mgravell Aug 30, 2025
e9cd0c9
more tests
mgravell Aug 30, 2025
f8d5faf
awaitable unit tests
mgravell Aug 31, 2025
cb0b10d
block buffer serializer
mgravell Aug 31, 2025
aeea3ad
Merge remote-tracking branch 'origin/marc/respite' into marc/respite
mgravell Sep 1, 2025
76cd60e
new test: #if parts for release buld
mgravell Sep 1, 2025
927b6aa
runnable
mgravell Sep 1, 2025
a470b9f
hunt perf glitch
mgravell Sep 1, 2025
804a209
packable
mgravell Sep 1, 2025
d602b7b
nits
mgravell Sep 1, 2025
9051a15
add random scrambles when recycling (debug only)
mgravell Sep 1, 2025
8e728a8
packaging
mgravell Sep 1, 2025
7d4d372
include readme in package
mgravell Sep 1, 2025
86032ab
custom memory manager
mgravell Sep 2, 2025
e276735
enable multi-message payloads (for batching)
mgravell Sep 2, 2025
a300f06
prevent message copy in batch
mgravell Sep 2, 2025
a35e364
machinery for block buffer
mgravell Sep 2, 2025
236da8c
batch test infrastructure
mgravell Sep 2, 2025
da3683a
test server FTW
mgravell Sep 2, 2025
3b31c7e
more test infrastructure
mgravell Sep 3, 2025
57cc9fd
more test infrastructure
mgravell Sep 3, 2025
3dd9b13
batch lifetime
mgravell Sep 3, 2025
e8e1cdc
Make ValueTaskExtensions part of the RESPite API
mgravell Sep 3, 2025
e14eddf
check single-await
mgravell Sep 3, 2025
c4a9264
re-integrate reader/writer tests; failing cancellation test in netfx,…
mgravell Sep 3, 2025
2a187cb
Merge remote-tracking branch 'origin/marc/respite' into marc/respite
mgravell Sep 3, 2025
11ee7b9
nits
mgravell Sep 3, 2025
60df5c7
necessary to make spell-checker happy
mgravell Sep 3, 2025
db81ca0
fix broken test re IVTS:Task cancellation
mgravell Sep 3, 2025
2ffdedb
improve token-error message
mgravell Sep 3, 2025
e606bb7
improve error message when pending
mgravell Sep 3, 2025
cf3f83b
deploy: multi-message batching
mgravell Sep 3, 2025
7c01375
add --basic, not functional yet
mgravell Sep 3, 2025
1271e1b
nits
mgravell Sep 3, 2025
95319b3
fix the basic loop, and implement for down-level
mgravell Sep 4, 2025
d5f0b58
nit: using
mgravell Sep 4, 2025
0b5e6ad
intermediate: RESPite.SERedis
mgravell Sep 4, 2025
3fa1056
Merge remote-tracking branch 'origin/marc/respite' into marc/respite
mgravell Sep 4, 2025
579efc9
last of the chops
mgravell Sep 4, 2025
fd0f492
IDE nits
mgravell Sep 5, 2025
3ac8b82
clean build
mgravell Sep 5, 2025
4d25240
eng improvements
mgravell Sep 5, 2025
1bfcbbd
eng: fix indirect context lookup
mgravell Sep 5, 2025
c140def
intermediate
mgravell Sep 5, 2025
06e4b1e
method splitout
mgravell Sep 5, 2025
6884560
get as far as connecting
mgravell Sep 5, 2025
5c1b0e3
start lighting up RedisValue/RedisKey APIs
mgravell Sep 5, 2025
1a22413
prefix/suffix tokens
mgravell Sep 5, 2025
2e0c1fe
replace immutable array
mgravell Sep 5, 2025
4d77cb4
implement some basic commands for benchark
mgravell Sep 6, 2025
19a62e5
proxied batches
mgravell Sep 6, 2025
d0656a0
naming is hard
mgravell Sep 6, 2025
9dbce2c
non-working overnight
mgravell Sep 9, 2025
2d1a740
in progress
mgravell Sep 15, 2025
c0f09dc
well, it compiles
mgravell Sep 16, 2025
999fb84
hset
mgravell Sep 19, 2025
5d1bde0
zadd
mgravell Sep 19, 2025
2259a34
MSET[NX], LRANGE, ZPOP{MIN|MAX}
mgravell Sep 19, 2025
e3bb6d9
xadd incomplete
mgravell Sep 19, 2025
7660a89
fix xadd
mgravell Sep 22, 2025
918e84d
use WriteRaw for literals
mgravell Sep 22, 2025
45a8a21
copyright stamp
mgravell Sep 22, 2025
78c037c
Teach generator how to handle collections and optional parameters
mgravell Sep 24, 2025
15f7eef
account for basic parameters!
mgravell Sep 24, 2025
cc3558f
hash tests (for memory repro)
mgravell Sep 25, 2025
fd8bbb1
Merge branch 'main' into marc/respite
mgravell Sep 26, 2025
d770e3d
Update ReleaseNotes.md
mgravell Sep 26, 2025
e7800ab
post-merge fixups
mgravell Sep 26, 2025
6e6db71
more post-merge fixups
mgravell Sep 26, 2025
e19f401
fix breaks
mgravell Sep 26, 2025
ce086d9
more bad merge
mgravell Sep 26, 2025
d6b7687
more bad merge
mgravell Sep 26, 2025
6bfab91
more drift
mgravell Sep 26, 2025
07897d2
more drift
mgravell Sep 26, 2025
1545618
more noise
mgravell Sep 26, 2025
fe04f9c
Merge branch 'main' into marc/respite
mgravell Sep 26, 2025
14a9aa3
use fixed qty in zpopmininit/lrangeinit
mgravell Sep 26, 2025
7f5de93
bench: improve init mechanism
mgravell Sep 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Build.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.Build.Traversal/3.0.2">
<ItemGroup>
<ProjectReference Include="eng\**\*.csproj" />
<ProjectReference Include="src\**\*.csproj" />
<ProjectReference Include="tests\**\*.csproj" />
<ProjectReference Include="toys\**\*.csproj" />
Expand Down
11 changes: 11 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project>
<PropertyGroup>
<!-- enables C# vNext features-->
<PreviewLangVersion>false</PreviewLangVersion>

<VersionPrefix>2.0.0</VersionPrefix>
<Copyright>2014 - $([System.DateTime]::Now.Year) Stack Exchange, Inc.</Copyright>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -26,7 +29,15 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IsPackable>false</IsPackable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<PublicKey>00240000048000009400000006020000002400005253413100040000010001007791a689e9d8950b44a9a8886baad2ea180e7a8a854f158c9b98345ca5009cdd2362c84f368f1c3658c132b3c0f74e44ff16aeb2e5b353b6e0fe02f923a050470caeac2bde47a2238a9c7125ed7dab14f486a5a64558df96640933b9f2b6db188fc4a820f96dce963b662fa8864adbff38e5b4542343f162ecdc6dad16912fff</PublicKey>
<RollForward>LatestMajor</RollForward>
</PropertyGroup>
<PropertyGroup Condition=" '$(PreviewLangVersion)' == 'true' ">
<LangVersion>preview</LangVersion>
<DefineConstants>$(DefineConstants);PREVIEW_LANGVER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
Expand Down
8 changes: 6 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="5.0.0" />
<PackageVersion Include="System.Threading.Channels" Version="5.0.0" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Memory" Version="4.6.3" />
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />

<!-- Packages used by RESPite related libraries-->
<PackageVersion Include="System.Collections.Immutable" Version="9.0.8" />

<!-- For analyzers, tied to the consumer's build SDK; at the moment, that means "us" -->
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />

<!-- Packages only used in the solution, upgrade at will -->
<PackageVersion Include="BenchmarkDotNet" Version="0.15.2" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
Expand All @@ -25,7 +30,6 @@
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="StackExchange.Redis" Version="2.6.96" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.Collections.Immutable" Version="9.0.0" />
<PackageVersion Include="System.Reflection.Metadata" Version="9.0.0" />

<!-- For binding redirect testing, main package gets this transitively -->
Expand Down
56 changes: 49 additions & 7 deletions StackExchange.Redis.sln
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,21 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "docs", "docs\docs.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackExchange.Redis.Benchmarks", "tests\StackExchange.Redis.Benchmarks\StackExchange.Redis.Benchmarks.csproj", "{59889284-FFEE-82E7-94CB-3B43E87DA6CF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eng", "eng", "{5FA0958E-6EBD-45F4-808E-3447A293F96F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESP.Core", "src\RESP.Core\RESP.Core.csproj", "{E50EEB8B-6B3F-4C8C-A5C6-C37FB87C01E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackExchange.Redis.Build", "eng\StackExchange.Redis.Build\StackExchange.Redis.Build.csproj", "{190742E1-FA50-4E36-A8C4-88AE87654340}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESPite.Tests", "tests\RESPite.Tests\RESPite.Tests.csproj", "{7063E2D3-C591-4604-A5DD-32D4A1678A58}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eng", "eng", "{C0132984-68D1-4A97-8F8C-AD4E2EECC583}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackExchange.Redis.Build", "eng\StackExchange.Redis.Build\StackExchange.Redis.Build.csproj", "{B0055B76-4685-4ECF-A904-88EE4E6FC8F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESPite", "src\RESPite\RESPite.csproj", "{F8762EE5-3461-4F6B-8C24-C876B6D9E637}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESPite.Redis", "src\RESPite.Redis\RESPite.Redis.csproj", "{3A92C2E7-3033-4FDF-8DDC-5DF43D290537}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESPite.StackExchange.Redis", "src\RESPite.StackExchange.Redis\RESPite.StackExchange.Redis.csproj", "{A5580114-C236-494E-851C-A21E3DB86FC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESPite.Benchmark", "src\RESPite.Benchmark\RESPite.Benchmark.csproj", "{3725A78B-B6B5-4379-9DE0-37A180ADE95A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -184,10 +196,34 @@ Global
{59889284-FFEE-82E7-94CB-3B43E87DA6CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59889284-FFEE-82E7-94CB-3B43E87DA6CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59889284-FFEE-82E7-94CB-3B43E87DA6CF}.Release|Any CPU.Build.0 = Release|Any CPU
{190742E1-FA50-4E36-A8C4-88AE87654340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{190742E1-FA50-4E36-A8C4-88AE87654340}.Debug|Any CPU.Build.0 = Debug|Any CPU
{190742E1-FA50-4E36-A8C4-88AE87654340}.Release|Any CPU.ActiveCfg = Release|Any CPU
{190742E1-FA50-4E36-A8C4-88AE87654340}.Release|Any CPU.Build.0 = Release|Any CPU
{E50EEB8B-6B3F-4C8C-A5C6-C37FB87C01E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E50EEB8B-6B3F-4C8C-A5C6-C37FB87C01E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E50EEB8B-6B3F-4C8C-A5C6-C37FB87C01E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E50EEB8B-6B3F-4C8C-A5C6-C37FB87C01E2}.Release|Any CPU.Build.0 = Release|Any CPU
{7063E2D3-C591-4604-A5DD-32D4A1678A58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7063E2D3-C591-4604-A5DD-32D4A1678A58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7063E2D3-C591-4604-A5DD-32D4A1678A58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7063E2D3-C591-4604-A5DD-32D4A1678A58}.Release|Any CPU.Build.0 = Release|Any CPU
{B0055B76-4685-4ECF-A904-88EE4E6FC8F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0055B76-4685-4ECF-A904-88EE4E6FC8F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0055B76-4685-4ECF-A904-88EE4E6FC8F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0055B76-4685-4ECF-A904-88EE4E6FC8F0}.Release|Any CPU.Build.0 = Release|Any CPU
{F8762EE5-3461-4F6B-8C24-C876B6D9E637}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8762EE5-3461-4F6B-8C24-C876B6D9E637}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8762EE5-3461-4F6B-8C24-C876B6D9E637}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8762EE5-3461-4F6B-8C24-C876B6D9E637}.Release|Any CPU.Build.0 = Release|Any CPU
{3A92C2E7-3033-4FDF-8DDC-5DF43D290537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A92C2E7-3033-4FDF-8DDC-5DF43D290537}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A92C2E7-3033-4FDF-8DDC-5DF43D290537}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A92C2E7-3033-4FDF-8DDC-5DF43D290537}.Release|Any CPU.Build.0 = Release|Any CPU
{A5580114-C236-494E-851C-A21E3DB86FC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5580114-C236-494E-851C-A21E3DB86FC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5580114-C236-494E-851C-A21E3DB86FC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5580114-C236-494E-851C-A21E3DB86FC8}.Release|Any CPU.Build.0 = Release|Any CPU
{3725A78B-B6B5-4379-9DE0-37A180ADE95A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3725A78B-B6B5-4379-9DE0-37A180ADE95A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3725A78B-B6B5-4379-9DE0-37A180ADE95A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3725A78B-B6B5-4379-9DE0-37A180ADE95A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -210,7 +246,13 @@ Global
{A0F89B8B-32A3-4C28-8F1B-ADE343F16137} = {73A5C363-CA1F-44C4-9A9B-EF791A76BA6A}
{69A0ACF2-DF1F-4F49-B554-F732DCA938A3} = {73A5C363-CA1F-44C4-9A9B-EF791A76BA6A}
{59889284-FFEE-82E7-94CB-3B43E87DA6CF} = {73A5C363-CA1F-44C4-9A9B-EF791A76BA6A}
{190742E1-FA50-4E36-A8C4-88AE87654340} = {5FA0958E-6EBD-45F4-808E-3447A293F96F}
{E50EEB8B-6B3F-4C8C-A5C6-C37FB87C01E2} = {00CA0876-DA9F-44E8-B0DC-A88716BF347A}
{7063E2D3-C591-4604-A5DD-32D4A1678A58} = {73A5C363-CA1F-44C4-9A9B-EF791A76BA6A}
{B0055B76-4685-4ECF-A904-88EE4E6FC8F0} = {C0132984-68D1-4A97-8F8C-AD4E2EECC583}
{F8762EE5-3461-4F6B-8C24-C876B6D9E637} = {00CA0876-DA9F-44E8-B0DC-A88716BF347A}
{3A92C2E7-3033-4FDF-8DDC-5DF43D290537} = {00CA0876-DA9F-44E8-B0DC-A88716BF347A}
{A5580114-C236-494E-851C-A21E3DB86FC8} = {00CA0876-DA9F-44E8-B0DC-A88716BF347A}
{3725A78B-B6B5-4379-9DE0-37A180ADE95A} = {00CA0876-DA9F-44E8-B0DC-A88716BF347A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {193AA352-6748-47C1-A5FC-C9AA6B5F000B}
Expand Down
7 changes: 6 additions & 1 deletion StackExchange.Redis.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OK/@EntryIndexedValue">OK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PONG/@EntryIndexedValue">PONG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RES/@EntryIndexedValue">RES</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SE/@EntryIndexedValue">SE</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pite/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=RESPite/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pubsub/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=vectorset/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=vectorset/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Current package versions:
- Add support for XPENDING Idle time filter ([#2822 by david-brink-talogy](https://github.com/StackExchange/StackExchange.Redis/pull/2822))
- Improve `double` formatting performance on net8+ ([#2928 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2928))
- Add `GetServer(RedisKey, ...)` API ([#2936 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2936))
- Fix error constructing `StreamAdd` message ([#2941 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2941))
- Fix error constructing `StreamAdd` message ([#2941 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2941))

## 2.8.58

Expand Down
55 changes: 55 additions & 0 deletions eng/StackExchange.Redis.Build/EasyArray.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Collections;

namespace StackExchange.Redis.Build;

/// <summary>
/// Think <c>ImmutableArray{T}</c>, but with structural equality.
/// </summary>
/// <typeparam name="T">The data being wrapped.</typeparam>
internal readonly struct EasyArray<T>(T[]? array) : IEquatable<EasyArray<T>>, IEnumerable<T>
{
public static readonly EasyArray<T> Empty = new([]);
private readonly T[]? _array = array ?? [];
public int Length => _array?.Length ?? 0;
public ref readonly T this[int index] => ref _array![index];
public ReadOnlySpan<T> Span => _array.AsSpan();
public bool IsEmpty => Length == 0;

public static bool operator ==(EasyArray<T> x, EasyArray<T> y)
=> x.Equals(y);

public static bool operator !=(EasyArray<T> x, EasyArray<T> y)
=> x.Equals(y);

public bool Equals(EasyArray<T> other)
{
T[]? tArr = this._array, oArr = other._array;
if (tArr is null) return oArr is null || oArr.Length == 0;
if (oArr is null) return tArr.Length == 0;

if (tArr.Length != oArr.Length) return false;
for (int i = 0; i < tArr.Length; i++)
{
if (ReferenceEquals(tArr[i], oArr[i]))
return false;
}
return true;
}

public IEnumerator<T> GetEnumerator() => ((IEnumerable<T>)(_array ?? [])).GetEnumerator();

public override bool Equals(object? obj)
=> obj is EasyArray<T> other && Equals(other);

public override int GetHashCode()
{
var arr = _array;
if (arr is null) return 0;
// use length and first item for a quick hash
return arr.Length == 0
? 0
: arr.Length ^ EqualityComparer<T>.Default.GetHashCode(arr[0]);
}

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
7 changes: 7 additions & 0 deletions eng/StackExchange.Redis.Build/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// ReSharper disable once CheckNamespace
namespace System.Runtime.CompilerServices;
#if !NET5_0_OR_GREATER
internal static class IsExternalInit
{
}
#endif
Loading
Loading