runtime: Regression in File.PreallocationSize

Run Information

Architecture x64
OS ubuntu 18.04
Baseline a8c2d1eae1726b1e6ec50716b7d4c34bc21ba96e
Compare ea062deec80053b822734802b40642bea36bed33
Diff Diff

Regressions in System.IO.Tests.Perf_FileStream

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
Write_NoBuffering_PreallocationSize - Duration of single invocation 34.65 ms 41.07 ms 1.19 0.05 True

graph Test Report

Repro

git clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net6.0 --filter 'System.IO.Tests.Perf_FileStream*'

Payloads

Baseline Compare

Histogram

System.IO.Tests.Perf_FileStream.Write_NoBuffering_PreallocationSize(fileSize: 104857600, userBufferSize: 16384, options: None)


Docs

Profiling workflow for dotnet/runtime repository Benchmarking workflow for dotnet/runtime repository

### Run Information
Architecture x64
OS ubuntu 18.04
Baseline a8c2d1eae1726b1e6ec50716b7d4c34bc21ba96e
Compare ea062deec80053b822734802b40642bea36bed33
Diff Diff

Regressions in System.Text.Json.Tests.Perf_Booleans

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio Baseline ETL Compare ETL
WriteBooleans - Duration of single invocation 1.23 ms 1.46 ms 1.18 0.01 False

graph Test Report

Repro

git clone https://github.com/dotnet/performance.git
python3 .\performance\scripts\benchmarks_ci.py -f net6.0 --filter 'System.Text.Json.Tests.Perf_Booleans*'

Payloads

Baseline Compare

Histogram

System.Text.Json.Tests.Perf_Booleans.WriteBooleans(Formatted: False, SkipValidation: True)


Docs

Profiling workflow for dotnet/runtime repository Benchmarking workflow for dotnet/runtime repository

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 49 (48 by maintainers)

Most upvoted comments

We had an offline discussion where we all agreed that currently the best thing we can do is to accept the regression as by design and keep the current implementation.

preallocationSize is a hint, that does not modify EOF and is not a strong guarantee. Depending on the hardware, OS and File System, the gain of specifying it before writing to the file can be:

  • up 5% on Linux
  • up 15% on Windows.

With current design we don’t risk data loss. For users who want event better perf, they can additionally call .SetLength.

We intend to update the docs and be very clear about it.

Thank you all for your input!

Thanks, Adam.