# Benchmarks

## Equality

Typely doesn't use the generic `EqualityComparer` and is therefore faster than records. Benchmark [here](https://github.com/adampaquette/Typely/blob/main/benchmarks/Typely.Benchmarks/EqualsBenchmark.cs).

### Primitives

#### Int

| Method                |      Mean |     Error |    StdDev |    Median | Allocated |
| --------------------- | --------: | --------: | --------: | --------: | --------: |
| Int\_EqualOperator    | 0.0028 ns | 0.0053 ns | 0.0050 ns | 0.0000 ns |         - |
| Int\_EqualityComparer | 0.0018 ns | 0.0031 ns | 0.0027 ns | 0.0004 ns |         - |
| Int\_Equals           | 0.0000 ns | 0.0001 ns | 0.0001 ns | 0.0000 ns |         - |

#### String

| Method                   |      Mean |     Error |    StdDev | Allocated |
| ------------------------ | --------: | --------: | --------: | --------: |
| String\_EqualOperator    | 2.4031 ns | 0.0227 ns | 0.0212 ns |         - |
| String\_EqualityComparer | 5.0523 ns | 0.0305 ns | 0.0270 ns |         - |
| String\_Equals           | 0.5165 ns | 0.0206 ns | 0.0182 ns |         - |
| String\_StaticEquals     | 2.4197 ns | 0.0249 ns | 0.0208 ns |         - |

#### Guid

| Method                 |     Mean |     Error |    StdDev | Allocated |
| ---------------------- | -------: | --------: | --------: | --------: |
| Guid\_EqualOperator    | 1.608 ns | 0.0062 ns | 0.0052 ns |         - |
| Guid\_EqualityComparer | 1.659 ns | 0.0358 ns | 0.0335 ns |         - |
| Guid\_Equals           | 1.334 ns | 0.0236 ns | 0.0197 ns |         - |

### Value objects

#### Int

| Method                           |      Mean |     Error |    StdDev |    Median | Allocated |
| -------------------------------- | --------: | --------: | --------: | --------: | --------: |
| ValueObjectInt\_EqualityComparer | 0.0013 ns | 0.0021 ns | 0.0018 ns | 0.0006 ns |         - |
| ValueObjectInt\_Equals           | 0.0148 ns | 0.0115 ns | 0.0108 ns | 0.0133 ns |         - |

#### String

| Method                              |     Mean |     Error |    StdDev | Allocated |
| ----------------------------------- | -------: | --------: | --------: | --------: |
| ValueObjectString\_EqualityComparer | 5.228 ns | 0.0702 ns | 0.0657 ns |         - |
| ValueObjectString\_Equals           | 2.643 ns | 0.0417 ns | 0.0370 ns |         - |
