Skip to content

Conversation

prozolic
Copy link

Performance benchmark for ImmutableArrayExtensions.SequenceEqual method (related to dotnet/runtime#118932).
I have created a new ImmutableArrayExtensions class and added one benchmark. While there are other extension methods for ImmutableArrayExtensions, this implementation focuses only on ImmutableArrayExtensions.SequenceEqual.

@prozolic
Copy link
Author

File name changed from ImmutableArrayExtensions.cs to Perf.ImmutableArrayExtensions.cs as well.

@DrewScoggins
Copy link
Member

How long does a single operation end up taking? We just want to make sure that we are not in the low nanosecond range.

@prozolic
Copy link
Author

The results themselves are the same as those listed in dotnet/runtime#118932.
The benchmark results are as follows:

| Method        | input       | Mean       | Error     | StdDev    | Median     | Min        | Max        | Gen0   | Allocated |
|-------------- |------------ |-----------:|----------:|----------:|-----------:|-----------:|-----------:|-------:|----------:|
| SequenceEqual | Array       |   5.671 ns | 0.3384 ns | 0.3897 ns |   5.544 ns |   5.419 ns |   7.055 ns |      - |         - |
| SequenceEqual | ICollection | 103.143 ns | 1.9016 ns | 1.7788 ns | 102.466 ns | 101.597 ns | 107.242 ns | 0.0037 |      32 B |
| SequenceEqual | IEnumerable | 107.665 ns | 2.1441 ns | 2.3832 ns | 106.737 ns | 105.110 ns | 113.926 ns | 0.0034 |      32 B |
| SequenceEqual | IList       |  53.489 ns | 0.1662 ns | 0.1555 ns |  53.459 ns |  53.242 ns |  53.848 ns |      - |         - |
| SequenceEqual | List        |   6.130 ns | 0.3136 ns | 0.3612 ns |   5.973 ns |   5.922 ns |   7.384 ns |      - |         - |

@prozolic prozolic requested a review from xtqqczze August 27, 2025 15:46
Copy link

@xtqqczze xtqqczze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prozolic I don’t have enough familiarity with this repository to provide a proper review.

@DrewScoggins
Copy link
Member

I will take a look at this today.

@xtqqczze
Copy link

I think it would sense to get this in before dotnet/runtime#118932 so we can properly validate the new implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants