Any reason you implement List and Array, why not implement just IList?
friuns2 opened this issue · 2 comments
friuns2 commented
Array and List both derive from Ilist interface, any reason you don't use IList instead?
jackmott commented
I believe there would be a performance hit in some, if not all cases. If you think not, I can do some quick benchmarks to experiment to confirm or deny.
jackmott commented
Yeah, comparing Sum using array vs IList:
BenchmarkDotNet=v0.10.3.0, OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-6700 CPU 3.40GHz, ProcessorCount=8
Frequency=3328126 Hz, Resolution=300.4694 ns, Timer=TSC
[Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.7.2600.0
RyuJitX64 : Clr 4.0.30319.42000, 64bit RyuJIT-v4.7.2600.0
Job=RyuJitX64 Jit=RyuJit Platform=X64
Method | TEST_SIZE | Mean | StdDev | Allocated |
---|---|---|---|---|
Sum | 100000 | 45.2131 us | 0.1464 us | 0 B |
SumIList | 100000 | 546.2191 us | 2.7519 us | 0 B |