Describe the bug
I updated the nuget from version 12.1.1 to version 21.0.2. I find the write performance is very bad. For 7000 records the v12 take less than 1 seconds, but v21 take 23 seconds.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The performance should be faster than v12
Performance degrade from v19->v20, with v19 it tooks 0.7s to parse file, but v20 uses longger than 1minutes, running on .NET 5.0 :-(
There's something going on with the parsing. 20 is is like 3.5 times faster than 19. https://www.joelverhagen.com/blog/2020/12/fastest-net-csv-parsers Can you post some example code on how you're using it?
I'm testing CsvHelper with linqpad6. Seems time spent on dynamic compile. I'll doing more test and post an example code later.
You can use BenchmarkDotNet in LINQPad. That's probably the best tool to measure performance.
You can use BenchmarkDotNet in LINQPad. That's probably the best tool to measure performance.
I'll post more detail in a new issue :-)
Hi @JoshClose , I can confirm that the issue comes with v20. I update from v12 to v19 which is faster than before.
I will post some example later.
I found the issue is a cache miss that affects both the reader and writer. I just tested writing a 1_000_000 line file with BenchmarkDotNet. Version 19 took 3.107 seconds mean time. The fixed 21 took 2.252 seconds mean time.
I'll release this today, but want to make sure the reading part is fixed also.
Fixed in 21.0.4 on NuGet. https://www.nuget.org/packages/CsvHelper/21.0.4