Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A simpler impl for ByteArrayEqualityComparer and remove redundant impl #3562

Merged

Conversation

nan01ab
Copy link
Contributor

@nan01ab nan01ab commented Nov 1, 2024

A better and simpler impl for ByteArrayEqualityComparer:

  1. Use SeqenceEqual for better performance and simpler implementation;
    Perf test on 4KiB equal bytes:
BenchmarkDotNet v0.13.12, macOS Ventura 13.7 (22H123) [Darwin 22.6.0]
Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET SDK 8.0.203
  [Host]     : .NET 8.0.3 (8.0.324.11423), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.3 (8.0.324.11423), X64 RyuJIT AVX2


| Method                            | Mean     | Error   | StdDev  |
|---------------------------------- |---------:|--------:|--------:|
| TestByteArrayEquals_SequenceEqual | 102.2 ns | 2.03 ns | 2.26 ns |
| TestByteArrayEquals_Unsafe        | 268.5 ns | 3.41 ns | 3.02 ns |
  1. Remove duplicated implementations;

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

A better and simpler impl for ByteArrayEqualityComparer
@nan01ab nan01ab changed the title A better and simpler implementation for ByteArrayEqualityComparer A simpler impl for ByteArrayEqualityComparer and remove redundant impl Nov 1, 2024
@Jim8y Jim8y added Waiting for Review Blocked This issue can't be worked at the moment labels Nov 3, 2024
shargon
shargon previously approved these changes Nov 7, 2024
@shargon shargon added Ready to Merge and removed Blocked This issue can't be worked at the moment Waiting for Review labels Nov 7, 2024
Jim8y
Jim8y previously approved these changes Nov 7, 2024
@shargon
Copy link
Member

shargon commented Nov 7, 2024

Wait for #3503

@shargon shargon dismissed stale reviews from Jim8y and themself via 2bda77f November 8, 2024 12:16
@shargon shargon requested a review from Jim8y November 8, 2024 12:19
@shargon shargon merged commit fb3adf7 into neo-project:master Nov 9, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants