Crc32.NET icon indicating copy to clipboard operation
Crc32.NET copied to clipboard

Hardware intrinsics

Open EduardSergeev opened this issue 2 years ago • 0 comments

Latest .NET frameworks have better support for hardware-accelerated CRC32 implementations:

  • CRC32C polynomial:
    • Intel CPUs supporting SSE4.2
    • ARM CPUs since ARMv8.1
  • CRC32 polynomial:
    • ARM CPUs since ARMv8.1

Note: Arm does support both CRC32 and CRC32C (since ARMv8.1) as does System.Runtime.Intrinsics.Arm (since .NET 5): CRC32 and CRC32C.

Test results (.NET 7):

  • Intel (Linux Mint 21.2, 11th Gen Intel Core i7-1165G7 2.80GHz CPU):
    Crc32.Crc32Algorithm Throughput: 435.0 MB/s
    K4os.Hash.Crc Throughput: 434.5 MB/s
    Crc32C.Standard Throughput: 1379.8 MB/s
    Force.Crc32.Crc32CAlgorithm Throughput: 1822.1 MB/s
    Force.Crc32.Crc32Algorithm Throughput: 1724.3 MB/s
    Force.Crc32.Intrinsics.Crc32CAlgorithm Throughput: 11116.4 MB/s
    
  • Arm (Amazon Linux 2, AWS c7g.large EC2: AWS Graviton3 CPU):
    Crc32.Crc32Algorithm Throughput: 352.8 MB/s
    K4os.Hash.Crc Throughput: 309.6 MB/s
    Crc32C.Standard Throughput: 1113.0 MB/s
    Force.Crc32.Crc32CAlgorithm Throughput: 1692.4 MB/s
    Force.Crc32.Crc32Algorithm Throughput: 1694.0 MB/s
    Force.Crc32.Intrinsics.Crc32CAlgorithm Throughput: 3278.2 MB/s
    Force.Crc32.Intrinsics.Crc32Algorithm Throughput: 3293.3 MB/s
    

Fixes #16

EduardSergeev avatar Aug 27 '23 22:08 EduardSergeev