Closed
Description
MemoryMappedFile.CreateNew
is 12-4 times slower on Linux compared to Windows. MemoryMappedFile.CreateFromFile
is 3x faster so there is a chance that we are doing something wrong.
Slower | diff/base | Windows Median (ns) | Linux Median (ns) | Modality |
---|---|---|---|---|
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateNew(capacity: 10000) | 12.77 | 2321.27 | 29641.41 | |
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateNew(capacity: 100000) | 12.12 | 2462.10 | 29849.96 | |
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateNew(capacity: 1000000) | 8.53 | 3967.32 | 33824.88 | bimodal |
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateNew(capacity: 10000000) | 4.83 | 6632.03 | 32033.40 | bimodal |
Faster | Win/Lin | Windows Median (ns) | Linux Median (ns) | Modality |
---|---|---|---|---|
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateFromFile(capacity: 10000000) | 3.68 | 150431.05 | 40823.03 | |
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateFromFile(capacity: 1000000) | 2.93 | 119037.20 | 40617.88 | |
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateFromFile(capacity: 10000) | 2.75 | 112842.91 | 41088.96 | |
System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateFromFile(capacity: 100000) | 2.67 | 110914.50 | 41580.16 | several? |
The contributor who wants to work on this issue should: |
- Run this simple benchmark from dotnet/performance repository and confirm the problem
git clone https://github.com/dotnet/performance.git
python3 ./performance/scripts/benchmarks_ci.py -f netcoreapp5.0 --filter System.IO.MemoryMappedFiles.Tests.Perf_MemoryMappedFile.CreateNew
- Build CoreFX locally: https://github.com/dotnet/performance/blob/master/docs/profiling-workflow-corefx.md#Build
- Create a small repro app: https://github.com/dotnet/performance/blob/master/docs/profiling-workflow-corefx.md#repro
- Use PerfCollect to identify issue https://github.com/dotnet/performance/blob/master/docs/profiling-workflow-corefx.md#PerfCollect
- Solve the issue