Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge feature/use-dllimport-generator to main #59579

Merged
merged 180 commits into from
Oct 18, 2021
Merged

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Sep 24, 2021

Merge the DllImportGenerator experiment to the main branch for .NET 7.

This should be merged with "Create a merge commit"

ASP.NET JSON macro-benchmark: #59579 (comment)
Libraries micro-benchmarks: #59579 (comment)

Items we will address once the initial merge happens: #60212

cc @stephentoub

AaronRobinsonMSFT and others added 30 commits July 12, 2020 17:52
  - Includes identification of GeneratedDllImportAttribute
  - Generation of enclosing types for partial methods
  - Basic tests for compilation of generation code


Commit migrated from dotnet/runtimelab@56076d3
  calls directly to the real DllImport from the generated one.

Add test for handling RefKind (i.e. in, ref, out).


Commit migrated from dotnet/runtimelab@3670643
 - User defined source needs to be "correct"


Commit migrated from dotnet/runtimelab@f9f705c
It is interesting to step into the generated method and observe the UX.


Commit migrated from dotnet/runtimelab@35c9adc
* Update readme with existing experiments
* Add "CreateAnExperiment.md"

Commit migrated from dotnet/runtimelab@542dd85
the attribute name.

Add test cases for compilation failures.


Commit migrated from dotnet/runtimelab@d2f6f5a
…melab#36)

* Collect DllImport details through Roslyn semantic model

Create an assembly that provides the GeneratedDllImportAttribute
  which allows use of the semantic model.

* Collect MarshalAsAttribute data

* Collect MarshalAsAttribute data
Convert P/Invoke centric data structures to handle positional
  type information for managed/unmanaged scenarios.

Commit migrated from dotnet/runtimelab@21e634e
… analyzer that validates manual usage. (dotnet/runtimelab#61)

Co-authored-by: Elinor Fung <[email protected]>

Commit migrated from dotnet/runtimelab@05d6ef2
* Use DNNE to create native testing assets

Instead of relying on a native project use DNNE to generate
native exports for managed binaries. This allows us to avoid
writing native code for testing code generation.

* Add *.binlog to .gitignore

* Force 'UseAppHost' to fix scenario on macOS.

* Consume support in DNNE for adding native binary to project.


Commit migrated from dotnet/runtimelab@415c6ca
* Rename DllImportGenerator.Test to DllImportGenerator.UnitTests

* Create an integration tests project.
Update the SLN file.
Remove SafeHandle test from Demo project.

* Update readme.md
Make the Demo project a user friendly example for learning about the methodology.

Commit migrated from dotnet/runtimelab@778ecfa
* Boolean and Delegate tests

Updated to DNNE 1.0.12 with support for C# function pointers.
Renamed CBoolMarshaller to ByteBoolMarshaller.
Added integration tests for all bool marshaller types.
Added integration tests for delegates.
Style nits.

Commit migrated from dotnet/runtimelab@6c980df
* Support for char marshaller.

Avoid supporting the built-in semantics for ANSI marshalling of char.
Propagate the CharSet down to the marshallers.
Convert the MarshallingGenerators.TryCreate() to a MarshallingGenerators.Create() function throwing an exception.

* Add a compatibility document.

* Add testing for char marshalling.

Commit migrated from dotnet/runtimelab@be3f4e8
* Fix some warnings about analyzer authoring

Commit migrated from dotnet/runtimelab@c89fc41
@jkoritzinsky
Copy link
Member Author

I've run the ASP.NET JSON macrobenchmark on this branch and compared it to main, and we see a minor performance improvement in steady state performance with this branch.

Baseline
application
CPU Usage (%) 97
Cores usage (%) 1,166
Working Set (MB) 182
Private Memory (MB) 771
Build Time (ms) 13,179
Start Time (ms) 184
Published Size (KB) 109,864
.NET Core SDK Version 5.0.401
ASP.NET Core Version 5.0.10+b92c9f5
.NET Runtime Version 7.0.0-alpha.1.21507.12+8fdd22d
load
CPU Usage (%) 62
Cores usage (%) 745
Working Set (MB) 50
Private Memory (MB) 358
Build Time (ms) 7,140
Start Time (ms) 0
Published Size (KB) 76,412
.NET Core SDK Version 3.1.413
ASP.NET Core Version 3.1.19+b908e91
.NET Runtime Version 3.1.19+aae0024
First Request (ms) 123
Requests/sec 469,558
Requests 7,090,260
Mean latency (ms) 0.79
Max latency (ms) 48.15
Bad responses 0
Socket errors 0
Read throughput (MB/s) 68.07
Latency 50th (ms) 0.50
Latency 75th (ms) 0.58
Latency 90th (ms) 0.72
Latency 99th (ms) 10.98
This PR
application
CPU Usage (%) 97
Cores usage (%) 1,168
Working Set (MB) 185
Private Memory (MB) 733
Build Time (ms) 10,301
Start Time (ms) 197
Published Size (KB) 110,366
.NET Core SDK Version 5.0.401
ASP.NET Core Version 5.0.10+b92c9f5
.NET Runtime Version 7.0.0-alpha.1.21507.14+78f4fa8
load
CPU Usage (%) 63
Cores usage (%) 754
Working Set (MB) 38
Private Memory (MB) 358
Start Time (ms) 0
First Request (ms) 129
Requests/sec 471,137
Requests 7,114,106
Mean latency (ms) 0.78
Max latency (ms) 52.35
Bad responses 0
Socket errors 0
Read throughput (MB/s) 68.30
Latency 50th (ms) 0.50
Latency 75th (ms) 0.58
Latency 90th (ms) 0.71
Latency 99th (ms) 10.73

@AaronRobinsonMSFT
Copy link
Member

/cc @davidfowl#59579 (comment).

@elinor-fung
Copy link
Member

elinor-fung commented Oct 11, 2021

Ran some of the microbenchmarks that hit updated p/invokes to check that we aren't regressing them.

On Windows with --statisticalTest 3%:

Perf_Console
Method Toolchain Mean Error StdDev Median Min Max Ratio MannWhitney(3%) Gen 0 Allocated
OpenStandardInput feature 465.5 ns 3.82 ns 3.39 ns 464.6 ns 461.4 ns 471.8 ns 0.94 Faster 0.0038 40 B
OpenStandardInput base 493.2 ns 1.57 ns 1.39 ns 493.2 ns 491.2 ns 496.0 ns 1.00 Base 0.0039 40 B
OpenStandardOutput feature 1,050.9 ns 6.94 ns 6.15 ns 1,051.0 ns 1,042.6 ns 1,060.5 ns 0.96 Faster 0.0042 40 B
OpenStandardOutput base 1,098.1 ns 1.99 ns 1.66 ns 1,098.4 ns 1,095.8 ns 1,100.5 ns 1.00 Base 0.0044 40 B
OpenStandardError feature 23,686.2 ns 78.54 ns 69.63 ns 23,675.9 ns 23,565.2 ns 23,805.7 ns 0.98 Same - 40 B
OpenStandardError base 24,148.1 ns 316.41 ns 295.97 ns 24,303.0 ns 23,675.7 ns 24,635.0 ns 1.00 Base - 40 B
ForegroundColor feature 29,121.9 ns 126.05 ns 111.74 ns 29,074.5 ns 28,981.6 ns 29,375.7 ns 1.00 Same - -
ForegroundColor base 29,149.9 ns 110.07 ns 85.93 ns 29,153.1 ns 28,959.7 ns 29,245.5 ns 1.00 Base - -
BackgroundColor feature 29,188.3 ns 120.56 ns 100.67 ns 29,158.4 ns 29,078.6 ns 29,426.3 ns 1.01 Same - -
BackgroundColor base 29,024.7 ns 226.00 ns 211.40 ns 28,966.0 ns 28,715.5 ns 29,518.7 ns 1.00 Base - -
ResetColor feature 59,375.2 ns 324.11 ns 303.17 ns 59,520.3 ns 58,880.4 ns 59,755.8 ns 0.99 Same - -
ResetColor base 59,806.7 ns 318.83 ns 282.63 ns 59,828.1 ns 59,342.5 ns 60,241.2 ns 1.00 Base - -
Perf_Directory
Method Toolchain UnrollFactor depth Mean Error StdDev Median Min Max Ratio MannWhitney(3%) RatioSD Gen 0 Allocated
CreateDirectory feature 1 ? 283,874.21 ns 14,099.292 ns 15,671.326 ns 285,210.00 ns 235,240.00 ns 305,010.00 ns 0.99 Same 0.02 - 505 B
CreateDirectory base 1 ? 290,341.43 ns 3,783.882 ns 3,354.313 ns 289,750.00 ns 286,340.00 ns 299,080.00 ns 1.00 Base 0.00 - 505 B
GetCurrentDirectory feature 16 ? 90.49 ns 0.596 ns 0.558 ns 90.18 ns 89.95 ns 91.62 ns 1.00 Same 0.01 0.0344 272 B
GetCurrentDirectory base 16 ? 90.49 ns 1.231 ns 1.151 ns 90.44 ns 89.11 ns 93.02 ns 1.00 Base 0.00 0.0346 272 B
Exists feature 16 ? 26,077.67 ns 131.351 ns 116.440 ns 26,074.80 ns 25,900.00 ns 26,274.42 ns 1.00 Same 0.01 - -
Exists base 16 ? 25,989.24 ns 215.599 ns 201.671 ns 25,985.35 ns 25,691.92 ns 26,291.26 ns 1.00 Base 0.00 - -
EnumerateFiles feature 16 ? 4,336,182.60 ns 79,847.239 ns 74,689.157 ns 4,307,796.88 ns 4,234,362.50 ns 4,500,879.69 ns 1.01 Same 0.02 171.8750 1,440,232 B
EnumerateFiles base 16 ? 4,285,867.50 ns 58,142.587 ns 54,386.612 ns 4,282,982.81 ns 4,218,610.94 ns 4,405,396.88 ns 1.00 Base 0.00 171.8750 1,440,232 B
RecursiveCreateDeleteDirectory feature 16 10 3,686,270.12 ns 119,939.923 ns 138,122.994 ns 3,680,808.12 ns 3,497,893.75 ns 3,881,205.00 ns 0.99 Same 0.03 - 7,742 B
RecursiveCreateDeleteDirectory base 16 10 3,717,791.75 ns 129,918.681 ns 149,614.547 ns 3,742,108.12 ns 3,488,150.00 ns 3,940,530.00 ns 1.00 Base 0.00 - 7,742 B
RecursiveCreateDeleteDirectory feature 16 100 41,018,445.00 ns 1,651,380.584 ns 1,901,732.337 ns 40,158,666.67 ns 38,694,600.00 ns 43,999,733.33 ns 1.02 Same 0.08 - 140,000 B
RecursiveCreateDeleteDirectory base 16 100 40,353,405.83 ns 1,560,227.910 ns 1,796,760.781 ns 40,095,491.67 ns 38,437,150.00 ns 43,621,866.67 ns 1.00 Base 0.00 - 140,000 B
Perf_File
Method Toolchain UnrollFactor size Mean Error StdDev Median Min Max Ratio MannWhitney(3%) RatioSD Gen 0 Allocated
Delete feature 1 ? 109.12 us 9.975 us 9.797 us 104.48 us 100.89 us 129.64 us 0.87 Same 0.22 - -
Delete base 1 ? 143.20 us 38.592 us 44.442 us 109.50 us 102.20 us 199.93 us 1.00 Base 0.00 - -
Exists feature 16 ? 26.53 us 0.190 us 0.178 us 26.47 us 26.26 us 26.90 us 0.99 Same 0.01 - -
Exists base 16 ? 26.91 us 0.390 us 0.346 us 26.88 us 26.57 us 27.89 us 1.00 Base 0.00 - -
AppendAllLines feature 16 ? 221.01 us 3.334 us 2.603 us 220.87 us 216.85 us 224.15 us 0.99 Same 0.02 1.0000 9,713 B
AppendAllLines base 16 ? 224.88 us 5.938 us 6.839 us 221.51 us 218.03 us 243.97 us 1.00 Base 0.00 1.0000 9,713 B
AppendAllLinesAsync feature 16 ? 266.06 us 8.875 us 9.865 us 269.06 us 244.00 us 276.86 us 1.00 Same 0.04 1.0000 10,627 B
AppendAllLinesAsync base 16 ? 267.16 us 11.859 us 13.657 us 268.06 us 239.66 us 284.31 us 1.00 Base 0.00 1.0000 10,627 B
AppendAllText feature 16 100 208.66 us 7.385 us 8.209 us 209.33 us 197.94 us 220.97 us 0.98 Same 0.06 - 6,576 B
AppendAllText base 16 100 212.99 us 7.043 us 8.110 us 210.16 us 204.64 us 231.85 us 1.00 Base 0.00 - 6,577 B
WriteAllText feature 16 100 266.53 us 11.947 us 13.759 us 270.47 us 240.71 us 295.40 us 1.02 Same 0.09 - 6,576 B
WriteAllText base 16 100 262.02 us 18.577 us 21.394 us 258.04 us 235.76 us 305.24 us 1.00 Base 0.00 - 6,576 B
AppendAllTextAsync feature 16 100 251.18 us 7.161 us 7.960 us 252.15 us 238.78 us 264.99 us 1.01 Same 0.03 1.0000 10,587 B
AppendAllTextAsync base 16 100 248.02 us 7.745 us 8.920 us 244.84 us 239.25 us 271.33 us 1.00 Base 0.00 1.0000 10,586 B
WriteAllTextAsync feature 16 100 343.71 us 11.069 us 11.844 us 344.33 us 321.57 us 365.14 us 1.03 Same 0.04 1.3298 10,649 B
WriteAllTextAsync base 16 100 335.50 us 7.129 us 8.209 us 332.34 us 325.52 us 349.60 us 1.00 Base 0.00 - 10,649 B
WriteAllBytes feature 16 512 272.19 us 7.498 us 8.334 us 269.19 us 258.25 us 292.12 us 1.02 Same 0.05 - 72 B
WriteAllBytes base 16 512 267.74 us 6.677 us 6.856 us 266.54 us 257.50 us 284.77 us 1.00 Base 0.00 - 73 B
WriteAllBytesAsync feature 16 512 328.12 us 17.210 us 19.819 us 326.91 us 298.52 us 366.07 us 1.01 Same 0.07 - 649 B
WriteAllBytesAsync base 16 512 324.08 us 16.843 us 19.397 us 317.69 us 297.70 us 361.70 us 1.00 Base 0.00 - 649 B
WriteAllBytes feature 16 4096 287.40 us 16.217 us 18.675 us 286.88 us 262.03 us 326.18 us 0.99 Same 0.06 - 73 B
WriteAllBytes base 16 4096 287.68 us 16.221 us 18.030 us 288.82 us 261.35 us 331.26 us 1.00 Base 0.00 - 73 B
WriteAllBytesAsync feature 16 4096 365.82 us 13.814 us 15.908 us 365.66 us 334.53 us 399.09 us 1.00 Same 0.06 - 650 B
WriteAllBytesAsync base 16 4096 364.59 us 17.086 us 18.992 us 362.19 us 325.49 us 398.63 us 1.00 Base 0.00 - 649 B
AppendAllText feature 16 10000 423.26 us 19.209 us 21.351 us 427.24 us 391.04 us 464.37 us 0.97 Same 0.08 1.0000 9,683 B
AppendAllText base 16 10000 438.79 us 13.168 us 14.090 us 438.49 us 417.40 us 467.63 us 1.00 Base 0.00 1.0000 9,682 B
WriteAllText feature 16 10000 382.03 us 21.358 us 22.853 us 374.52 us 358.25 us 435.63 us 1.02 Same 0.07 - 9,681 B
WriteAllText base 16 10000 374.07 us 7.467 us 7.668 us 372.23 us 364.05 us 389.75 us 1.00 Base 0.00 - 9,681 B
AppendAllTextAsync feature 16 10000 520.84 us 19.473 us 21.644 us 523.96 us 487.78 us 571.48 us 0.98 Same 0.05 1.0000 11,051 B
AppendAllTextAsync base 16 10000 530.96 us 20.371 us 23.459 us 529.09 us 493.09 us 565.34 us 1.00 Base 0.00 1.0000 11,050 B
WriteAllTextAsync feature 16 10000 498.27 us 19.384 us 20.740 us 503.71 us 452.50 us 521.62 us 1.00 Same 0.05 - 11,243 B
WriteAllTextAsync base 16 10000 498.91 us 9.625 us 9.003 us 497.24 us 484.46 us 516.01 us 1.00 Base 0.00 - 11,269 B
WriteAllBytes feature 16 16384 303.08 us 6.006 us 5.899 us 304.15 us 292.08 us 311.03 us 1.01 Same 0.06 - 73 B
WriteAllBytes base 16 16384 300.79 us 12.978 us 13.886 us 301.87 us 265.23 us 325.34 us 1.00 Base 0.00 - 73 B
WriteAllBytesAsync feature 16 16384 367.98 us 19.476 us 22.428 us 365.41 us 328.34 us 407.87 us 0.97 Same 0.08 - 649 B
WriteAllBytesAsync base 16 16384 379.02 us 22.577 us 25.094 us 375.69 us 325.64 us 435.90 us 1.00 Base 0.00 - 649 B
WriteAllText feature 16 100000 555.62 us 57.620 us 66.355 us 520.80 us 492.23 us 737.46 us 0.86 Faster 0.11 - 9,681 B
WriteAllText base 16 100000 644.68 us 20.548 us 22.839 us 643.18 us 610.06 us 695.49 us 1.00 Base 0.00 - 9,681 B
WriteAllTextAsync feature 16 100000 1,128.82 us 45.530 us 48.716 us 1,130.30 us 1,045.36 us 1,214.43 us 1.00 Same 0.05 - 14,594 B
WriteAllTextAsync base 16 100000 1,133.95 us 37.446 us 41.621 us 1,121.61 us 1,089.03 us 1,231.48 us 1.00 Base 0.00 - 14,604 B
WriteAllBytes feature 16 1048576 532.48 us 11.637 us 13.401 us 525.80 us 518.26 us 561.06 us 1.00 Same 0.04 - 73 B
WriteAllBytes base 16 1048576 533.17 us 13.248 us 14.725 us 523.78 us 519.21 us 573.24 us 1.00 Base 0.00 - 73 B
WriteAllBytesAsync feature 16 1048576 622.87 us 13.173 us 14.095 us 621.44 us 595.94 us 649.70 us 1.00 Same 0.03 - 650 B
WriteAllBytesAsync base 16 1048576 623.23 us 12.784 us 14.722 us 624.29 us 602.51 us 648.39 us 1.00 Base 0.00 - 650 B
WriteAllBytes feature 16 104857600 99,986.22 us 452.014 us 352.903 us 100,013.60 us 99,350.15 us 100,425.40 us 1.00 Same 0.01 - 312 B
WriteAllBytes base 16 104857600 99,953.53 us 1,276.552 us 1,131.630 us 99,265.80 us 98,608.20 us 102,158.32 us 1.00 Base 0.00 - 192 B
WriteAllBytesAsync feature 16 104857600 99,485.94 us 537.831 us 449.113 us 99,481.25 us 98,826.15 us 100,359.60 us 1.00 Same 0.01 - 1,032 B
WriteAllBytesAsync base 16 104857600 99,388.34 us 561.578 us 497.824 us 99,418.80 us 98,555.95 us 100,157.70 us 1.00 Base 0.00 - 1,200 B
Perf_FileStream
Method Toolchain fileSize userBufferSize options Mean Error StdDev Median Min Max Ratio MannWhitney(3%) RatioSD Gen 0 Gen 1 Allocated
Read feature 1024 1024 None 47,794.05 ns 227.282 ns 201.480 ns 47,714.12 ns 47,526.33 ns 48,179.18 ns 1.02 Same 0.00 0.3799 0.1900 4,352 B
Read base 1024 1024 None 46,951.04 ns 201.537 ns 178.657 ns 47,005.25 ns 46,556.87 ns 47,247.77 ns 1.00 Base 0.00 0.3754 0.1877 4,352 B
Write feature 1024 1024 None 305,581.68 ns 8,076.317 ns 8,641.569 ns 305,307.09 ns 294,740.75 ns 322,471.15 ns 1.01 Same 0.03 - - 4,353 B
Write base 1024 1024 None 301,607.63 ns 9,747.681 ns 10,429.909 ns 296,891.45 ns 291,708.96 ns 328,317.69 ns 1.00 Base 0.00 - - 4,353 B
ReadAsync feature 1024 1024 None 99,006.78 ns 614.988 ns 513.543 ns 98,937.14 ns 98,297.32 ns 100,139.20 ns 1.00 Same 0.01 0.4464 - 5,032 B
ReadAsync base 1024 1024 None 98,838.24 ns 494.220 ns 438.113 ns 98,780.69 ns 98,243.79 ns 99,720.19 ns 1.00 Base 0.00 0.4112 - 5,032 B
WriteAsync feature 1024 1024 None 302,551.16 ns 7,206.689 ns 7,711.076 ns 299,142.73 ns 295,134.01 ns 323,079.81 ns 1.00 Same 0.03 - - 4,441 B
WriteAsync base 1024 1024 None 301,759.14 ns 5,757.147 ns 5,912.166 ns 299,084.20 ns 293,709.55 ns 313,665.33 ns 1.00 Base 0.00 - - 4,441 B
Read feature 1024 1024 Asynchronous 61,503.87 ns 241.833 ns 226.210 ns 61,507.32 ns 61,047.34 ns 61,834.20 ns 1.02 Same 0.01 0.4883 0.2441 4,600 B
Read base 1024 1024 Asynchronous 60,333.19 ns 334.215 ns 296.273 ns 60,181.68 ns 59,942.25 ns 60,827.78 ns 1.00 Base 0.00 0.4826 0.2413 4,600 B
Write feature 1024 1024 Asynchronous 307,968.95 ns 7,437.158 ns 8,266.382 ns 307,194.58 ns 297,219.81 ns 328,075.24 ns 1.01 Same 0.05 - - 4,601 B
Write base 1024 1024 Asynchronous 304,637.32 ns 10,983.654 ns 11,752.386 ns 299,274.88 ns 293,945.75 ns 337,416.27 ns 1.00 Base 0.00 - - 4,601 B
ReadAsync feature 1024 1024 Asynchronous 112,855.84 ns 370.930 ns 309.744 ns 112,928.10 ns 112,259.12 ns 113,184.67 ns 1.00 Same 0.01 0.4562 - 5,240 B
ReadAsync base 1024 1024 Asynchronous 112,933.25 ns 544.579 ns 509.400 ns 112,988.41 ns 112,094.66 ns 113,696.57 ns 1.00 Base 0.00 0.5040 - 5,240 B
WriteAsync feature 1024 1024 Asynchronous 310,737.12 ns 10,981.809 ns 12,206.252 ns 304,619.25 ns 297,157.88 ns 339,849.12 ns 1.02 Same 0.04 - - 4,689 B
WriteAsync base 1024 1024 Asynchronous 304,420.95 ns 7,463.836 ns 7,986.220 ns 303,457.55 ns 293,542.33 ns 316,344.34 ns 1.00 Base 0.00 - - 4,689 B
OpenClose feature 1024 ? None 35,581.11 ns 226.056 ns 211.453 ns 35,623.35 ns 35,210.17 ns 35,922.22 ns 1.01 Same 0.01 - - 232 B
OpenClose base 1024 ? None 35,173.23 ns 354.616 ns 314.358 ns 35,049.88 ns 34,858.76 ns 35,886.75 ns 1.00 Base 0.00 - - 232 B
LockUnlock feature 1024 ? None 50,770.28 ns 297.896 ns 264.077 ns 50,745.32 ns 50,421.32 ns 51,277.67 ns 1.00 Same 0.01 - - 232 B
LockUnlock base 1024 ? None 50,587.82 ns 92.514 ns 86.538 ns 50,609.70 ns 50,398.05 ns 50,698.46 ns 1.00 Base 0.00 - - 232 B
SeekForward feature 1024 ? None 48,110.49 ns 155.350 ns 137.714 ns 48,054.85 ns 47,968.79 ns 48,377.90 ns 1.00 Same 0.00 - - 232 B
SeekForward base 1024 ? None 48,215.66 ns 199.936 ns 166.955 ns 48,240.50 ns 47,906.73 ns 48,536.56 ns 1.00 Base 0.00 - - 232 B
SeekBackward feature 1024 ? None 52,836.99 ns 150.125 ns 140.427 ns 52,804.29 ns 52,668.22 ns 53,187.94 ns 1.00 Same 0.00 - - 232 B
SeekBackward base 1024 ? None 52,777.42 ns 219.029 ns 194.164 ns 52,762.42 ns 52,385.80 ns 53,196.57 ns 1.00 Base 0.00 - - 232 B
ReadByte feature 1024 ? None 49,935.65 ns 389.576 ns 364.410 ns 49,791.28 ns 49,425.30 ns 50,557.01 ns 0.99 Same 0.01 0.3981 0.1990 4,352 B
ReadByte base 1024 ? None 50,330.85 ns 454.515 ns 379.540 ns 50,171.43 ns 50,006.81 ns 51,192.96 ns 1.00 Base 0.00 0.3968 0.1984 4,352 B
WriteByte feature 1024 ? None 314,657.72 ns 13,023.384 ns 14,997.749 ns 312,058.23 ns 297,619.39 ns 349,290.05 ns 1.01 Same 0.07 - - 4,353 B
WriteByte base 1024 ? None 314,501.40 ns 11,378.459 ns 12,647.127 ns 311,988.52 ns 297,434.31 ns 343,106.51 ns 1.00 Base 0.00 - - 4,353 B
Flush feature 1024 ? None 3,237,858.80 ns 143,741.617 ns 159,768.426 ns 3,245,419.27 ns 3,023,394.27 ns 3,591,735.94 ns 1.02 Same 0.06 - - 4,357 B
Flush base 1024 ? None 3,167,053.18 ns 116,539.181 ns 124,695.618 ns 3,196,320.31 ns 3,000,535.42 ns 3,463,610.42 ns 1.00 Base 0.00 - - 4,357 B
FlushAsync feature 1024 ? None 4,478,112.19 ns 253,693.020 ns 292,153.259 ns 4,460,757.29 ns 4,086,268.75 ns 5,116,643.75 ns 0.95 Same 0.07 20.8333 - 160,464 B
FlushAsync base 1024 ? None 4,698,127.42 ns 153,635.456 ns 176,926.819 ns 4,680,718.75 ns 4,286,986.72 ns 4,976,757.03 ns 1.00 Base 0.00 15.6250 - 160,460 B
CopyToFile feature 1024 ? None 363,877.64 ns 7,017.834 ns 7,509.004 ns 360,500.99 ns 356,932.24 ns 379,581.82 ns 1.00 Same 0.03 - - 4,585 B
CopyToFile base 1024 ? None 364,418.84 ns 6,836.340 ns 6,714.200 ns 361,284.16 ns 358,203.49 ns 375,509.16 ns 1.00 Base 0.00 - - 4,585 B
CopyToFileAsync feature 1024 ? None 388,035.74 ns 9,439.182 ns 10,099.819 ns 383,378.58 ns 376,286.43 ns 407,513.41 ns 0.97 Same 0.05 - - 5,450 B
CopyToFileAsync base 1024 ? None 399,489.82 ns 17,557.558 ns 18,786.391 ns 392,544.61 ns 380,803.12 ns 449,202.50 ns 1.00 Base 0.00 - - 5,450 B
OpenClose feature 1024 ? Asynchronous 38,789.89 ns 190.496 ns 168.870 ns 38,777.86 ns 38,417.71 ns 39,080.26 ns 1.02 Same 0.01 - - 264 B
OpenClose base 1024 ? Asynchronous 38,007.81 ns 148.759 ns 131.871 ns 38,005.33 ns 37,805.99 ns 38,215.50 ns 1.00 Base 0.00 - - 264 B
LockUnlock feature 1024 ? Asynchronous 56,649.42 ns 268.105 ns 250.785 ns 56,627.13 ns 56,304.19 ns 57,232.34 ns 1.00 Same 0.01 - - 264 B
LockUnlock base 1024 ? Asynchronous 56,790.68 ns 258.810 ns 242.091 ns 56,803.34 ns 56,277.01 ns 57,132.87 ns 1.00 Base 0.00 - - 264 B
SeekForward feature 1024 ? Asynchronous 54,038.02 ns 167.530 ns 148.511 ns 54,014.25 ns 53,852.23 ns 54,358.37 ns 0.99 Same 0.00 - - 264 B
SeekForward base 1024 ? Asynchronous 54,431.38 ns 236.613 ns 209.752 ns 54,388.09 ns 54,083.16 ns 54,810.03 ns 1.00 Base 0.00 - - 264 B
SeekBackward feature 1024 ? Asynchronous 61,239.18 ns 268.935 ns 251.562 ns 61,290.36 ns 60,835.55 ns 61,655.96 ns 1.01 Same 0.00 - - 264 B
SeekBackward base 1024 ? Asynchronous 60,375.97 ns 215.129 ns 167.959 ns 60,411.86 ns 60,087.43 ns 60,641.39 ns 1.00 Base 0.00 - - 264 B
ReadByte feature 1024 ? Asynchronous 61,200.25 ns 213.688 ns 189.429 ns 61,223.98 ns 60,816.81 ns 61,456.18 ns 0.99 Same 0.01 0.4902 0.2451 4,600 B
ReadByte base 1024 ? Asynchronous 61,662.07 ns 529.772 ns 469.629 ns 61,580.35 ns 61,078.89 ns 62,683.22 ns 1.00 Base 0.00 0.4921 0.2461 4,600 B
WriteByte feature 1024 ? Asynchronous 329,226.06 ns 13,108.738 ns 14,570.327 ns 323,057.55 ns 312,361.59 ns 368,330.08 ns 1.02 Same 0.04 - - 4,601 B
WriteByte base 1024 ? Asynchronous 321,888.53 ns 8,009.344 ns 8,569.909 ns 319,918.36 ns 311,797.27 ns 343,429.69 ns 1.00 Base 0.00 - - 4,601 B
Flush feature 1024 ? Asynchronous 10,002,648.51 ns 240,941.656 ns 267,806.012 ns 10,005,769.57 ns 9,591,347.83 ns 10,388,052.17 ns 1.00 Same 0.03 - - 225,601 B
Flush base 1024 ? Asynchronous 9,968,961.84 ns 237,758.937 ns 264,268.429 ns 9,956,518.75 ns 9,506,181.25 ns 10,384,840.62 ns 1.00 Base 0.00 - - 225,592 B
FlushAsync feature 1024 ? Asynchronous 15,240,391.15 ns 428,163.447 ns 493,073.663 ns 15,200,392.31 ns 14,576,930.77 ns 16,473,907.69 ns 0.99 Same 0.05 - - 160,715 B
FlushAsync base 1024 ? Asynchronous 15,385,865.83 ns 498,370.460 ns 573,924.163 ns 15,192,320.83 ns 14,808,191.67 ns 16,715,100.00 ns 1.00 Base 0.00 - - 160,720 B
CopyToFileAsync feature 1024 ? Asynchronous 468,274.20 ns 4,549.166 ns 3,551.690 ns 468,612.68 ns 460,876.29 ns 474,611.03 ns 1.00 Same 0.03 - - 6,058 B
CopyToFileAsync base 1024 ? Asynchronous 468,939.73 ns 10,358.942 ns 11,513.936 ns 464,406.61 ns 454,497.68 ns 488,769.46 ns 1.00 Base 0.00 - - 6,058 B
Read feature 1048576 512 None 805,271.17 ns 2,957.504 ns 2,766.451 ns 806,676.25 ns 801,152.50 ns 808,796.25 ns 1.02 Same 0.01 - - 4,354 B
Read base 1048576 512 None 786,338.46 ns 3,898.361 ns 3,455.795 ns 788,230.00 ns 779,907.50 ns 789,842.81 ns 1.00 Base 0.00 - - 4,354 B
Write feature 1048576 512 None 2,111,978.38 ns 140,500.774 ns 156,166.238 ns 2,077,657.14 ns 1,881,303.57 ns 2,442,628.57 ns 0.98 Same 0.11 - - 4,356 B
Write base 1048576 512 None 2,181,868.15 ns 157,531.012 ns 168,556.418 ns 2,148,627.68 ns 1,986,307.14 ns 2,644,975.00 ns 1.00 Base 0.00 - - 4,356 B
ReadAsync feature 1048576 512 None 1,354,084.62 ns 12,624.489 ns 11,808.955 ns 1,350,196.88 ns 1,338,895.83 ns 1,371,312.50 ns 1.02 Same 0.03 - - 4,992 B
ReadAsync base 1048576 512 None 1,330,649.70 ns 26,514.425 ns 29,470.713 ns 1,337,540.62 ns 1,289,075.00 ns 1,375,676.04 ns 1.00 Base 0.00 - - 4,994 B
WriteAsync feature 1048576 512 None 3,186,907.12 ns 197,629.292 ns 211,461.128 ns 3,214,451.56 ns 2,845,384.38 ns 3,701,545.31 ns 1.05 Same 0.11 - - 4,984 B
WriteAsync base 1048576 512 None 3,054,810.39 ns 185,845.950 ns 190,850.108 ns 3,090,664.06 ns 2,736,831.25 ns 3,394,660.94 ns 1.00 Base 0.00 - - 4,998 B
Read feature 1048576 512 Asynchronous 2,411,859.82 ns 14,855.955 ns 13,169.417 ns 2,417,098.21 ns 2,385,900.00 ns 2,429,957.14 ns 1.00 Same 0.01 - - 59,687 B
Read base 1048576 512 Asynchronous 2,405,879.67 ns 12,823.517 ns 10,708.217 ns 2,407,523.21 ns 2,385,833.93 ns 2,425,958.04 ns 1.00 Base 0.00 - - 59,688 B
Write feature 1048576 512 Asynchronous 3,860,794.39 ns 138,385.893 ns 142,112.124 ns 3,892,740.62 ns 3,601,750.00 ns 4,169,771.88 ns 1.00 Same 0.05 - - 59,692 B
Write base 1048576 512 Asynchronous 3,850,331.34 ns 112,590.880 ns 115,622.545 ns 3,893,675.00 ns 3,596,137.50 ns 4,008,271.88 ns 1.00 Base 0.00 - - 59,692 B
ReadAsync feature 1048576 512 Asynchronous 3,888,748.26 ns 89,472.642 ns 95,734.725 ns 3,887,691.67 ns 3,742,387.50 ns 4,118,560.42 ns 1.00 Same 0.02 - - 5,252 B
ReadAsync base 1048576 512 Asynchronous 3,868,889.73 ns 28,648.586 ns 25,396.225 ns 3,858,753.91 ns 3,839,125.00 ns 3,931,876.56 ns 1.00 Base 0.00 - - 5,239 B
WriteAsync feature 1048576 512 Asynchronous 6,356,087.84 ns 195,068.198 ns 224,640.827 ns 6,344,102.70 ns 6,013,148.65 ns 6,831,421.62 ns 0.96 Same 0.03 - - 5,461 B
WriteAsync base 1048576 512 Asynchronous 6,599,772.22 ns 147,781.828 ns 158,124.900 ns 6,634,431.25 ns 6,253,975.00 ns 6,862,602.08 ns 1.00 Base 0.00 - - 5,375 B
Read feature 1048576 4096 None 754,079.49 ns 5,527.520 ns 4,900.002 ns 752,247.77 ns 747,665.77 ns 762,145.54 ns 1.01 Same 0.01 - - 234 B
Read base 1048576 4096 None 749,345.76 ns 1,878.969 ns 1,569.024 ns 749,619.35 ns 745,657.14 ns 751,992.86 ns 1.00 Base 0.00 - - 234 B
Write feature 1048576 4096 None 2,022,701.59 ns 77,129.669 ns 82,527.882 ns 2,018,416.07 ns 1,919,032.14 ns 2,193,852.68 ns 0.93 Faster 0.06 - - 236 B
Write base 1048576 4096 None 2,178,365.18 ns 139,863.819 ns 149,652.720 ns 2,127,929.91 ns 2,001,677.68 ns 2,539,576.79 ns 1.00 Base 0.00 - - 236 B
ReadAsync feature 1048576 4096 None 971,686.77 ns 6,107.310 ns 5,712.781 ns 971,464.06 ns 963,068.36 ns 981,896.88 ns 1.01 Same 0.01 - - 723 B
ReadAsync base 1048576 4096 None 961,802.37 ns 8,917.671 ns 8,341.595 ns 960,276.95 ns 949,815.23 ns 979,311.33 ns 1.00 Base 0.00 - - 723 B
WriteAsync feature 1048576 4096 None 2,453,478.01 ns 109,070.224 ns 116,703.918 ns 2,474,889.06 ns 2,235,471.88 ns 2,663,180.21 ns 0.94 Same 0.10 - - 733 B
WriteAsync base 1048576 4096 None 2,696,384.11 ns 266,037.215 ns 306,368.852 ns 2,515,109.38 ns 2,416,722.92 ns 3,345,884.38 ns 1.00 Base 0.00 - - 728 B
Append feature 1048576 4096 DeleteOnClose 2,147,201.93 ns 114,052.497 ns 122,034.894 ns 2,127,302.68 ns 1,973,035.27 ns 2,375,529.91 ns 1.00 Same 0.08 - - 236 B
Append base 1048576 4096 DeleteOnClose 2,155,341.93 ns 111,434.561 ns 119,233.732 ns 2,123,872.66 ns 1,973,098.44 ns 2,477,187.50 ns 1.00 Base 0.00 - - 236 B
Read feature 1048576 4096 Asynchronous 2,427,303.19 ns 32,621.312 ns 28,917.943 ns 2,424,706.70 ns 2,376,183.04 ns 2,473,919.64 ns 1.03 Same 0.02 - - 55,568 B
Read base 1048576 4096 Asynchronous 2,366,349.81 ns 19,543.233 ns 17,324.567 ns 2,366,288.84 ns 2,342,508.93 ns 2,402,070.54 ns 1.00 Base 0.00 - - 55,568 B
Write feature 1048576 4096 Asynchronous 3,844,096.96 ns 194,887.219 ns 216,616.628 ns 3,840,785.94 ns 3,476,854.69 ns 4,243,960.94 ns 0.97 Same 0.07 - - 55,572 B
Write base 1048576 4096 Asynchronous 3,987,810.20 ns 228,035.533 ns 253,460.890 ns 3,989,446.88 ns 3,642,431.25 ns 4,478,782.81 ns 1.00 Base 0.00 - - 55,572 B
ReadAsync feature 1048576 4096 Asynchronous 3,662,512.68 ns 68,915.959 ns 61,092.202 ns 3,653,790.00 ns 3,573,685.00 ns 3,777,246.25 ns 0.99 Same 0.02 - - 939 B
ReadAsync base 1048576 4096 Asynchronous 3,709,300.50 ns 67,238.123 ns 62,894.582 ns 3,676,957.50 ns 3,636,277.50 ns 3,818,272.50 ns 1.00 Base 0.00 - - 939 B
WriteAsync feature 1048576 4096 Asynchronous 5,831,316.46 ns 230,353.783 ns 265,275.759 ns 5,813,307.29 ns 5,398,906.25 ns 6,356,104.17 ns 0.96 Same 0.06 - - 944 B
WriteAsync base 1048576 4096 Asynchronous 6,091,471.06 ns 270,557.066 ns 289,493.030 ns 6,125,859.38 ns 5,632,775.00 ns 6,717,779.17 ns 1.00 Base 0.00 - - 944 B
AppendAsync feature 1048576 4096 DeleteOnClose, Asynchronous 6,000,890.86 ns 230,208.120 ns 246,320.109 ns 6,036,430.21 ns 5,362,935.42 ns 6,308,154.17 ns 1.01 Same 0.07 - - 944 B
AppendAsync base 1048576 4096 DeleteOnClose, Asynchronous 5,957,676.54 ns 222,699.461 ns 247,529.861 ns 5,876,233.33 ns 5,567,022.92 ns 6,526,445.83 ns 1.00 Base 0.00 - - 944 B
Read_NoBuffering feature 1048576 16384 None 261,687.52 ns 1,500.661 ns 1,403.720 ns 261,142.29 ns 260,038.12 ns 264,243.65 ns 1.00 Same 0.01 - - 169 B
Read_NoBuffering base 1048576 16384 None 262,823.68 ns 1,244.338 ns 1,163.955 ns 262,944.70 ns 261,321.08 ns 264,579.56 ns 1.00 Base 0.00 - - 169 B
Write_NoBuffering feature 1048576 16384 None 1,161,379.83 ns 37,360.338 ns 39,975.143 ns 1,159,073.80 ns 1,102,235.58 ns 1,256,773.56 ns 1.01 Same 0.05 - - 170 B
Write_NoBuffering base 1048576 16384 None 1,151,391.47 ns 53,497.212 ns 54,937.698 ns 1,139,090.62 ns 1,075,524.55 ns 1,262,736.61 ns 1.00 Base 0.00 - - 170 B
ReadAsync_NoBuffering feature 1048576 16384 None 372,957.27 ns 7,427.204 ns 6,947.411 ns 372,089.43 ns 363,434.38 ns 384,427.68 ns 1.01 Same 0.03 - - 569 B
ReadAsync_NoBuffering base 1048576 16384 None 368,584.87 ns 5,534.715 ns 4,906.381 ns 367,273.21 ns 362,704.61 ns 379,329.91 ns 1.00 Base 0.00 - - 569 B
WriteAsync_NoBuffering feature 1048576 16384 None 1,280,234.84 ns 66,291.878 ns 68,076.878 ns 1,267,913.94 ns 1,181,300.48 ns 1,457,015.87 ns 1.00 Same 0.09 - - 572 B
WriteAsync_NoBuffering base 1048576 16384 None 1,296,192.60 ns 79,336.013 ns 84,888.645 ns 1,273,094.23 ns 1,186,918.75 ns 1,486,636.54 ns 1.00 Base 0.00 - - 572 B
Write_NoBuffering_PreallocationSize feature 1048576 16384 None 852,228.25 ns 16,173.965 ns 15,129.137 ns 850,202.30 ns 834,593.09 ns 890,437.17 ns 1.01 Same 0.03 - - -
Write_NoBuffering_PreallocationSize base 1048576 16384 None 842,174.79 ns 16,164.266 ns 13,497.894 ns 835,911.81 ns 828,001.39 ns 869,674.65 ns 1.00 Base 0.00 - - -
Read_NoBuffering feature 1048576 16384 Asynchronous 655,252.68 ns 7,461.083 ns 6,614.056 ns 655,757.94 ns 645,989.84 ns 667,402.86 ns 1.01 Same 0.03 - - 14,026 B
Read_NoBuffering base 1048576 16384 Asynchronous 652,845.31 ns 15,706.271 ns 18,087.366 ns 650,496.09 ns 624,000.52 ns 684,182.03 ns 1.00 Base 0.00 - - 14,026 B
Write_NoBuffering feature 1048576 16384 Asynchronous 1,656,573.75 ns 72,340.359 ns 74,288.222 ns 1,644,886.88 ns 1,543,862.50 ns 1,818,801.88 ns 1.04 Same 0.06 - - 14,029 B
Write_NoBuffering base 1048576 16384 Asynchronous 1,597,993.89 ns 59,369.636 ns 63,524.846 ns 1,578,353.44 ns 1,492,581.88 ns 1,746,371.88 ns 1.00 Base 0.00 - - 14,029 B
ReadAsync_NoBuffering feature 1048576 16384 Asynchronous 1,059,561.10 ns 14,414.628 ns 12,778.192 ns 1,057,265.00 ns 1,034,439.58 ns 1,085,392.50 ns 1.01 Same 0.02 - - 779 B
ReadAsync_NoBuffering base 1048576 16384 Asynchronous 1,052,386.56 ns 11,299.116 ns 10,569.200 ns 1,053,511.25 ns 1,036,529.58 ns 1,075,979.17 ns 1.00 Base 0.00 - - 780 B
WriteAsync_NoBuffering feature 1048576 16384 Asynchronous 2,174,548.87 ns 49,331.444 ns 54,831.770 ns 2,159,867.86 ns 2,099,317.86 ns 2,256,354.46 ns 1.04 Same 0.04 - - 783 B
WriteAsync_NoBuffering base 1048576 16384 Asynchronous 2,100,521.29 ns 63,077.287 ns 70,110.238 ns 2,099,020.54 ns 1,998,760.71 ns 2,241,258.04 ns 1.00 Base 0.00 - - 783 B
WriteAsync_NoBuffering_PreallocationSize feature 1048576 16384 Asynchronous 1,889,718.91 ns 35,184.725 ns 36,132.122 ns 1,901,418.06 ns 1,815,089.58 ns 1,954,740.28 ns 0.97 Same 0.04 - - -
WriteAsync_NoBuffering_PreallocationSize base 1048576 16384 Asynchronous 1,954,547.51 ns 51,845.481 ns 57,626.115 ns 1,943,088.89 ns 1,872,472.22 ns 2,077,129.86 ns 1.00 Base 0.00 - - -
CopyToFile feature 1048576 ? None 878,168.09 ns 20,911.412 ns 21,474.480 ns 877,402.30 ns 846,164.14 ns 923,324.34 ns 1.00 Same 0.05 - - 467 B
CopyToFile base 1048576 ? None 879,725.35 ns 37,373.469 ns 39,989.193 ns 867,079.17 ns 841,259.38 ns 979,771.88 ns 1.00 Base 0.00 - - 467 B
CopyToFileAsync feature 1048576 ? None 1,014,425.22 ns 39,369.980 ns 40,430.071 ns 1,002,705.42 ns 949,874.58 ns 1,099,800.42 ns 1.01 Same 0.07 - - 1,485 B
CopyToFileAsync base 1048576 ? None 1,010,409.77 ns 43,084.312 ns 47,888.099 ns 1,007,455.86 ns 956,250.00 ns 1,108,585.55 ns 1.00 Base 0.00 - - 1,484 B
CopyToFileAsync feature 1048576 ? Asynchronous 1,316,047.61 ns 23,413.973 ns 18,280.090 ns 1,311,840.10 ns 1,286,410.42 ns 1,350,338.54 ns 1.00 Same 0.02 - - 2,054 B
CopyToFileAsync base 1048576 ? Asynchronous 1,318,048.09 ns 14,292.640 ns 11,158.753 ns 1,317,561.46 ns 1,300,718.23 ns 1,336,801.56 ns 1.00 Base 0.00 - - 2,054 B
Read feature 104857600 4096 None 94,224,746.43 ns 722,218.574 ns 640,227.954 ns 94,412,937.50 ns 93,113,850.00 ns 95,007,075.00 ns 1.03 Same 0.01 - - 352 B
Read base 104857600 4096 None 91,406,312.50 ns 316,920.514 ns 280,941.781 ns 91,490,412.50 ns 90,895,075.00 ns 91,838,075.00 ns 1.00 Base 0.00 - - 534 B
Write feature 104857600 4096 None 193,722,472.22 ns 23,915,698.424 ns 25,589,529.372 ns 192,766,250.00 ns 153,413,400.00 ns 245,223,100.00 ns 0.93 Same 0.25 - - 712 B
Write base 104857600 4096 None 209,466,635.00 ns 35,803,866.563 ns 41,231,785.977 ns 196,838,400.00 ns 151,984,700.00 ns 302,618,900.00 ns 1.00 Base 0.00 - - 2,832 B
ReadAsync feature 104857600 4096 None 109,077,284.62 ns 1,097,202.764 ns 916,214.000 ns 109,334,350.00 ns 108,005,050.00 ns 110,862,500.00 ns 1.00 Same 0.01 - - 1,104 B
ReadAsync base 104857600 4096 None 108,858,396.43 ns 382,658.441 ns 339,216.741 ns 108,789,450.00 ns 108,207,800.00 ns 109,361,100.00 ns 1.00 Base 0.00 - - 1,104 B
WriteAsync feature 104857600 4096 None 227,018,440.00 ns 35,404,879.206 ns 40,772,311.544 ns 229,792,100.00 ns 182,094,800.00 ns 311,534,400.00 ns 1.07 Same 0.17 - - 1,776 B
WriteAsync base 104857600 4096 None 218,388,422.22 ns 22,674,363.556 ns 24,261,314.970 ns 219,625,900.00 ns 183,155,800.00 ns 273,067,000.00 ns 1.00 Base 0.00 - - 1,488 B
Read feature 104857600 4096 Asynchronous 252,923,938.46 ns 898,777.432 ns 750,519.862 ns 252,857,200.00 ns 251,157,100.00 ns 253,746,200.00 ns 1.00 Same 0.01 - - 5,531,352 B
Read base 104857600 4096 Asynchronous 253,877,753.33 ns 2,982,661.333 ns 2,789,983.262 ns 254,312,200.00 ns 247,425,900.00 ns 257,734,800.00 ns 1.00 Base 0.00 - - 5,532,488 B
Write feature 104857600 4096 Asynchronous 402,580,825.00 ns 43,241,364.563 ns 49,796,819.735 ns 386,590,600.00 ns 326,987,300.00 ns 490,653,900.00 ns 1.03 Same 0.21 - - 5,541,832 B
Write base 104857600 4096 Asynchronous 399,992,805.00 ns 39,536,495.084 ns 45,530,286.532 ns 387,832,750.00 ns 334,263,500.00 ns 486,904,300.00 ns 1.00 Base 0.00 - - 5,532,664 B
ReadAsync feature 104857600 4096 Asynchronous 382,516,046.67 ns 7,185,570.792 ns 6,721,387.377 ns 381,487,500.00 ns 370,730,600.00 ns 393,315,800.00 ns 1.02 Same 0.02 - - 4,152 B
ReadAsync base 104857600 4096 Asynchronous 373,614,440.00 ns 5,341,845.121 ns 4,996,765.241 ns 373,754,300.00 ns 367,584,600.00 ns 382,869,400.00 ns 1.00 Base 0.00 - - 2,472 B
WriteAsync feature 104857600 4096 Asynchronous 578,869,400.00 ns 37,553,265.788 ns 43,246,396.726 ns 579,466,300.00 ns 496,098,000.00 ns 665,653,800.00 ns 0.94 Same 0.11 - - 5,504 B
WriteAsync base 104857600 4096 Asynchronous 622,093,645.00 ns 39,911,327.034 ns 45,961,943.563 ns 616,034,600.00 ns 547,796,400.00 ns 719,184,300.00 ns 1.00 Base 0.00 - - 3,688 B
Read_NoBuffering feature 104857600 16384 None 37,410,353.57 ns 224,786.252 ns 199,267.157 ns 37,451,575.00 ns 37,141,050.00 ns 37,753,800.00 ns 1.01 Same 0.01 - - 396 B
Read_NoBuffering base 104857600 16384 None 36,901,617.14 ns 294,585.395 ns 275,555.361 ns 36,893,414.29 ns 36,554,942.86 ns 37,426,157.14 ns 1.00 Base 0.00 - - 237 B
Write_NoBuffering feature 104857600 16384 None 59,609,682.14 ns 1,149,331.170 ns 1,018,852.146 ns 59,434,050.00 ns 58,350,475.00 ns 61,712,875.00 ns 0.96 Same 0.03 - - 288 B
Write_NoBuffering base 104857600 16384 None 61,685,770.31 ns 1,802,437.356 ns 1,770,234.491 ns 61,411,837.50 ns 59,715,875.00 ns 65,583,300.00 ns 1.00 Base 0.00 - - 1,114 B
ReadAsync_NoBuffering feature 104857600 16384 None 42,971,505.13 ns 241,665.443 ns 201,801.590 ns 42,954,100.00 ns 42,556,566.67 ns 43,339,016.67 ns 0.99 Same 0.01 - - 877 B
ReadAsync_NoBuffering base 104857600 16384 None 43,167,833.33 ns 418,817.784 ns 391,762.415 ns 43,247,466.67 ns 42,638,883.33 ns 44,060,816.67 ns 1.00 Base 0.00 - - 696 B
WriteAsync_NoBuffering feature 104857600 16384 None 67,394,141.67 ns 1,569,220.425 ns 1,679,048.274 ns 67,055,000.00 ns 65,438,025.00 ns 71,107,100.00 ns 0.99 Same 0.04 - - 1,750 B
WriteAsync_NoBuffering base 104857600 16384 None 68,068,523.61 ns 2,984,491.488 ns 3,193,372.456 ns 67,074,400.00 ns 65,034,550.00 ns 75,968,450.00 ns 1.00 Base 0.00 - - 1,602 B
Write_NoBuffering_PreallocationSize feature 104857600 16384 None 51,119,603.85 ns 362,507.878 ns 302,710.496 ns 51,137,625.00 ns 50,507,150.00 ns 51,546,425.00 ns 1.01 Same 0.01 - - -
Write_NoBuffering_PreallocationSize base 104857600 16384 None 50,841,844.64 ns 582,627.784 ns 516,484.355 ns 50,732,287.50 ns 50,295,750.00 ns 52,166,250.00 ns 1.00 Base 0.00 - - -
Read_NoBuffering feature 104857600 16384 Asynchronous 84,522,456.67 ns 873,713.413 ns 817,272.069 ns 84,176,125.00 ns 83,510,650.00 ns 86,351,800.00 ns 1.01 Same 0.01 - - 1,382,974 B
Read_NoBuffering base 104857600 16384 Asynchronous 83,869,947.92 ns 625,860.100 ns 488,630.398 ns 83,913,825.00 ns 82,821,475.00 ns 84,876,400.00 ns 1.00 Base 0.00 - - 1,382,792 B
Write_NoBuffering feature 104857600 16384 Asynchronous 115,158,592.11 ns 4,579,217.629 ns 5,089,788.262 ns 113,061,500.00 ns 109,513,750.00 ns 126,676,550.00 ns 0.99 Same 0.06 - - 1,384,860 B
Write_NoBuffering base 104857600 16384 Asynchronous 117,220,297.06 ns 5,827,298.367 ns 5,984,206.390 ns 115,471,150.00 ns 110,291,100.00 ns 130,435,850.00 ns 1.00 Base 0.00 - - 1,383,948 B
ReadAsync_NoBuffering feature 104857600 16384 Asynchronous 132,965,167.86 ns 1,403,376.349 ns 1,244,056.579 ns 133,329,775.00 ns 130,807,800.00 ns 134,741,300.00 ns 1.02 Same 0.01 - - 1,688 B
ReadAsync_NoBuffering base 104857600 16384 Asynchronous 129,961,196.15 ns 1,425,126.839 ns 1,190,045.455 ns 129,748,500.00 ns 128,371,300.00 ns 132,348,350.00 ns 1.00 Base 0.00 - - 1,160 B
WriteAsync_NoBuffering feature 104857600 16384 Asynchronous 169,568,685.00 ns 8,217,657.250 ns 9,463,466.310 ns 170,281,450.00 ns 155,281,200.00 ns 190,523,500.00 ns 1.00 Same 0.05 - - 1,544 B
WriteAsync_NoBuffering base 104857600 16384 Asynchronous 169,294,370.00 ns 5,286,827.091 ns 6,088,317.940 ns 168,534,500.00 ns 157,309,900.00 ns 179,270,700.00 ns 1.00 Base 0.00 - - 4,168 B
WriteAsync_NoBuffering_PreallocationSize feature 104857600 16384 Asynchronous 143,548,615.79 ns 2,743,390.637 ns 3,049,271.424 ns 143,190,900.00 ns 139,451,800.00 ns 149,736,400.00 ns 0.97 Same 0.03 - - -
WriteAsync_NoBuffering_PreallocationSize base 104857600 16384 Asynchronous 147,782,808.33 ns 2,874,676.002 ns 2,244,357.934 ns 147,805,850.00 ns 143,348,200.00 ns 151,241,200.00 ns 1.00 Base 0.00 - - -
CopyToFile feature 104857600 ? None 64,210,432.69 ns 1,116,444.732 ns 932,281.915 ns 63,950,050.00 ns 63,215,450.00 ns 66,575,400.00 ns 1.01 Same 0.02 - - 668 B
CopyToFile base 104857600 ? None 63,208,091.67 ns 1,162,039.243 ns 1,086,972.228 ns 62,767,275.00 ns 61,836,250.00 ns 65,164,900.00 ns 1.00 Base 0.00 - - 668 B
CopyToFileAsync feature 104857600 ? None 70,442,667.31 ns 1,001,086.490 ns 835,952.559 ns 70,248,750.00 ns 69,255,050.00 ns 72,619,625.00 ns 0.99 Same 0.02 - - 1,756 B
CopyToFileAsync base 104857600 ? None 71,104,023.61 ns 1,413,300.305 ns 1,512,215.492 ns 70,739,125.00 ns 69,306,800.00 ns 74,570,350.00 ns 1.00 Base 0.00 - - 5,854 B
CopyToFileAsync feature 104857600 ? Asynchronous 108,894,796.15 ns 880,047.422 ns 734,879.455 ns 108,942,550.00 ns 107,932,200.00 ns 110,536,400.00 ns 1.00 Same 0.01 - - 2,600 B
CopyToFileAsync base 104857600 ? Asynchronous 108,693,046.15 ns 1,008,272.065 ns 841,952.839 ns 108,679,900.00 ns 107,281,750.00 ns 110,529,250.00 ns 1.00 Base 0.00 - - 2,600 B
GetLength feature ? ? Read 45.57 ns 0.130 ns 0.101 ns 45.57 ns 45.43 ns 45.73 ns 1.00 Same 0.00 - - -
GetLength base ? ? Read 45.42 ns 0.157 ns 0.139 ns 45.45 ns 45.19 ns 45.71 ns 1.00 Base 0.00 - - -
GetLength feature ? ? Write 1,821.11 ns 5.103 ns 4.774 ns 1,821.63 ns 1,814.99 ns 1,832.43 ns 1.00 Same 0.00 - - -
GetLength base ? ? Write 1,826.95 ns 6.196 ns 5.795 ns 1,828.86 ns 1,813.60 ns 1,832.08 ns 1.00 Base 0.00 - - -
Perf_Hashing
Method Toolchain Mean Error StdDev Median Min Max Ratio MannWhitney(3%) RatioSD Allocated
Sha1 feature 180.9 ms 1.40 ms 1.31 ms 180.5 ms 179.6 ms 183.4 ms 1.00 Same 0.01 576 B
Sha1 base 180.6 ms 1.23 ms 1.09 ms 180.3 ms 179.5 ms 182.8 ms 1.00 Base 0.00 576 B
Sha256 feature 447.6 ms 2.95 ms 2.76 ms 448.0 ms 444.2 ms 452.8 ms 1.00 Same 0.01 4,200 B
Sha256 base 447.2 ms 2.27 ms 1.89 ms 446.3 ms 444.9 ms 451.9 ms 1.00 Base 0.00 3,944 B
Sha384 feature 266.3 ms 2.68 ms 2.51 ms 266.3 ms 263.3 ms 272.0 ms 0.95 Faster 0.02 4,216 B
Sha384 base 281.2 ms 3.20 ms 3.00 ms 280.6 ms 277.5 ms 285.7 ms 1.00 Base 0.00 3,976 B
Sha512 feature 267.3 ms 2.23 ms 2.08 ms 267.6 ms 263.6 ms 269.6 ms 0.94 Faster 0.03 4,264 B
Sha512 base 285.2 ms 8.49 ms 9.08 ms 280.7 ms 277.6 ms 309.1 ms 1.00 Base 0.00 1,352 B
Perf_NamedPipeStream
Method Toolchain size Options Mean Error StdDev Median Min Max Ratio MannWhitney(3%) RatioSD Allocated
ReadWrite feature 1000000 None 153.5 us 1.85 us 1.54 us 153.3 us 151.0 us 156.5 us 0.99 Same 0.03 1 B
ReadWrite base 1000000 None 155.6 us 3.94 us 4.38 us 155.0 us 150.0 us 164.7 us 1.00 Base 0.00 1 B
ReadWriteAsync feature 1000000 None 195.1 us 11.62 us 13.38 us 200.5 us 164.4 us 209.9 us 1.05 Same 0.12 401 B
ReadWriteAsync base 1000000 None 186.4 us 12.70 us 14.62 us 186.7 us 162.4 us 208.0 us 1.00 Base 0.00 401 B
ReadWrite feature 1000000 Asynchronous 226.3 us 1.99 us 1.86 us 226.1 us 223.3 us 229.8 us 1.00 Same 0.01 353 B
ReadWrite base 1000000 Asynchronous 225.9 us 1.38 us 1.22 us 225.6 us 224.5 us 228.3 us 1.00 Base 0.00 353 B
ReadWriteAsync feature 1000000 Asynchronous 201.0 us 3.15 us 2.63 us 201.8 us 192.6 us 202.6 us 0.98 Same 0.02 1 B
ReadWriteAsync base 1000000 Asynchronous 205.7 us 1.15 us 1.07 us 205.6 us 204.1 us 207.7 us 1.00 Base 0.00 1 B
SslStreamTests
Method Toolchain protocol Mean Error StdDev Median Min Max Ratio MannWhitney(3%) RatioSD Gen 0 Allocated
DefaultHandshakeContextIPv4Async feature ? 19,621.84 us 122.995 us 102.707 us 19,610.68 us 19,499.85 us 19,784.67 us 1.01 Same 0.01 - 17,293 B
DefaultHandshakeContextIPv4Async base ? 19,501.38 us 88.755 us 74.114 us 19,482.19 us 19,403.14 us 19,693.31 us 1.00 Base 0.00 - 17,376 B
DefaultHandshakeContextIPv6Async feature ? 19,566.52 us 88.361 us 82.653 us 19,549.09 us 19,464.19 us 19,719.18 us 1.00 Same 0.01 - 17,293 B
DefaultHandshakeContextIPv6Async base ? 19,611.11 us 88.456 us 82.742 us 19,585.61 us 19,492.93 us 19,783.74 us 1.00 Base 0.00 - 17,293 B
DefaultHandshakeIPv4Async feature ? 19,605.73 us 74.391 us 69.585 us 19,592.37 us 19,519.21 us 19,733.02 us 1.00 Same 0.01 - 18,385 B
DefaultHandshakeIPv4Async base ? 19,561.50 us 56.590 us 47.255 us 19,554.16 us 19,478.55 us 19,646.75 us 1.00 Base 0.00 - 18,406 B
DefaultHandshakeIPv6Async feature ? 19,608.79 us 63.459 us 56.254 us 19,598.75 us 19,530.24 us 19,728.67 us 1.00 Same 0.00 - 18,403 B
DefaultHandshakeIPv6Async base ? 19,685.98 us 100.609 us 89.187 us 19,670.42 us 19,554.86 us 19,853.57 us 1.00 Base 0.00 - 18,403 B
WriteReadAsync feature ? 44.26 us 0.256 us 0.240 us 44.18 us 43.95 us 44.80 us 1.00 Same 0.01 - -
WriteReadAsync base ? 44.41 us 0.164 us 0.154 us 44.42 us 44.16 us 44.73 us 1.00 Base 0.00 - -
ReadWriteAsync feature ? 55.11 us 0.646 us 0.604 us 55.26 us 54.21 us 56.05 us 1.01 Same 0.01 0.0400 336 B
ReadWriteAsync base ? 54.63 us 0.308 us 0.257 us 54.66 us 54.13 us 55.09 us 1.00 Base 0.00 0.0400 337 B
ConcurrentReadWrite feature ? 69.93 us 1.351 us 1.387 us 69.78 us 67.59 us 72.46 us 0.96 Same 0.03 0.0200 255 B
ConcurrentReadWrite base ? 72.81 us 1.417 us 1.575 us 72.09 us 70.87 us 75.78 us 1.00 Base 0.00 0.0400 397 B
ConcurrentReadWriteLargeBuffer feature ? 77.60 us 2.922 us 3.000 us 76.86 us 74.64 us 84.74 us 0.98 Same 0.05 - 190 B
ConcurrentReadWriteLargeBuffer base ? 79.07 us 2.479 us 2.652 us 78.13 us 76.16 us 86.28 us 1.00 Base 0.00 - 226 B
HandshakeContosoAsync feature Tls12 19,532.94 us 103.514 us 96.827 us 19,508.72 us 19,407.70 us 19,736.12 us 1.01 Same 0.01 - 19,853 B
HandshakeContosoAsync base Tls12 19,398.35 us 103.881 us 92.088 us 19,350.18 us 19,302.12 us 19,571.13 us 1.00 Base 0.00 - 19,853 B
HandshakeECDSA256CertAsync feature Tls12 7,072.83 us 32.142 us 30.065 us 7,087.34 us 7,021.41 us 7,108.41 us 1.00 Same 0.01 - 18,416 B
HandshakeECDSA256CertAsync base Tls12 7,062.98 us 49.105 us 43.531 us 7,047.70 us 7,016.76 us 7,164.05 us 1.00 Base 0.00 - 18,423 B
HandshakeRSA1024CertAsync feature Tls12 6,356.77 us 44.771 us 41.879 us 6,346.90 us 6,307.94 us 6,429.49 us 1.00 Same 0.01 - 18,605 B
HandshakeRSA1024CertAsync base Tls12 6,341.40 us 66.056 us 61.789 us 6,313.69 us 6,265.78 us 6,499.12 us 1.00 Base 0.00 - 18,604 B
HandshakeRSA2048CertAsync feature Tls12 8,542.91 us 61.772 us 57.782 us 8,543.93 us 8,469.27 us 8,634.13 us 1.00 Same 0.01 - 18,998 B
HandshakeRSA2048CertAsync base Tls12 8,510.36 us 45.630 us 42.682 us 8,506.02 us 8,462.29 us 8,616.71 us 1.00 Base 0.00 - 18,998 B
HandshakeRSA4096CertAsync feature Tls12 19,637.15 us 39.985 us 37.402 us 19,635.46 us 19,582.85 us 19,703.58 us 1.00 Same 0.01 - 19,813 B
HandshakeRSA4096CertAsync base Tls12 19,735.36 us 140.278 us 124.353 us 19,709.62 us 19,552.78 us 19,909.09 us 1.00 Base 0.00 - 19,813 B

The file system ones I ran a bunch of times - from the historical results, it seems like there is quite a bit of variation. I had a mix of test cases flagged faster / slower, but not the same test case consistently.

@jkoritzinsky jkoritzinsky marked this pull request as ready for review October 11, 2021 18:20
@kasperk81
Copy link
Contributor

Is there a document stating short intro, rationale and/or benefit of this feature? The disadvantages appear to be: it increases code size in this repository, increases compiled assembly size and there is no significant gain in performance either.

@jkoritzinsky
Copy link
Member Author

@kasperk81 here's the overall design doc for the feature: https://github.com/dotnet/runtime/blob/main/docs/design/features/source-generator-pinvokes.md

The primary benefits of this feature are: better diagnostics (the marshalling stubs are actually debuggable), better AOT and linker compatibility (the AOT compiler doesn't need to hard-code implicit dependencies that the runtime uses to implement the built-in marshalling), and easier evolution (moving the marshalling infrastructure to run at compile time makes it easier for us to fix bugs since changes don't affect every P/Invoke that the user's application uses, even ones they didn't write).

@AaronRobinsonMSFT
Copy link
Member

and there is no significant gain in performance either.

@kasperk81 This is a short term and intentional non-goal. The reasoning is we want to ensure a high level of confidence and compatibility for v1. To that end we did do some optimizations, but very few. As we gain confidence with how this methodology works we are free to try optimizations that are targeted as opposed to the "everyone gets it" design with the built-in system. As we get further into .NET 7 and onto .NET 8 we are considering opportunities for better performance in this area.

@jkoritzinsky
Copy link
Member Author

It looks like something from #59590 might have broken this PR. I'll take a look probably after the hackathon.

cc: @VSadov if you get a chance to take a look sooner, I'd appreciate it.

@elinor-fung
Copy link
Member

elinor-fung commented Oct 12, 2021

@VSadov - looks like things are failing across the board (not just in this PR) - not sure why the CI in #59590 didn't fail 😕

      Assert failure(PID 1208 [0x000004b8], Thread: 4164 [0x1044]): m_pLayoutLock->IsWriterLock()
      
      CORECLR! PEImage::LoadFlat + 0x1B5 (0x00007ffc`f01b98e5)
      CORECLR! AssemblyNative::LoadFromStream + 0x186 (0x00007ffc`f0295e66)
      SYSTEM.PRIVATE.CORELIB! <no symbol> + 0x0 (0x00007ffc`ef763fd0)
      SYSTEM.PRIVATE.CORELIB! <no symbol> + 0x0 (0x00007ffc`ef78be3a)
      <no module>! <no symbol> + 0x0 (0x00007ffc`90cfd4f7)
      <no module>! <no symbol> + 0x0 (0x000002a6`3d50a398)
          File: D:\a\_work\1\s\src\coreclr\vm\peimage.cpp Line: 797
          Image: C:\h\w\9F0308EC\p\corerun.exe
      Assert failure(PID 2756 [0x00000ac4], Thread: 3364 [0x0d24]): m_pLayoutLock->IsWriterLock()
      
      CORECLR! PEImage::LoadImageW + 0x497 (0x00007ffc`f01ba1e7)
      CORECLR! AssemblyNative::LoadFromInMemoryModule + 0x143 (0x00007ffc`f0294b03)
      SYSTEM.PRIVATE.CORELIB! <no symbol> + 0x0 (0x00007ffc`ef764049)
      SYSTEM.PRIVATE.CORELIB! <no symbol> + 0x0 (0x00007ffc`ef7640f9)
      SYSTEM.PRIVATE.CORELIB! <no symbol> + 0x0 (0x00007ffc`ef8598be)
      <no module>! <no symbol> + 0x0 (0x00007ffc`90cfc847)
      IJWNATIVECALLINGMANAGEDDLL! <no symbol> + 0x0 (0x00007ffd`09190000)
      <no module>! <no symbol> + 0x0 (0x000002c7`56feda9c)
          File: D:\a\_work\1\s\src\coreclr\vm\peimage.cpp Line: 797
          Image: C:\h\w\9F0308EC\p\corerun.exe

@elinor-fung
Copy link
Member

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

AaronRobinsonMSFT and others added 3 commits October 13, 2021 17:59
…60374)

* Update StructMarshalling.md with details

Co-authored-by: Elinor Fung <[email protected]>
Co-authored-by: Jeremy Koritzinsky <[email protected]>
* Remove dotnet-experimental feed from NuGet.config
* Revert changes to solution files and restore configs
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@safern
Copy link
Member

safern commented Oct 18, 2021

Merging with a merge commit as it was requested to preserve the history of commits coming from the experiment.

@safern safern merged commit b201a16 into main Oct 18, 2021
@jkoritzinsky jkoritzinsky deleted the feature/use-dllimport-generator branch October 18, 2021 23:13
@ghost ghost locked as resolved and limited conversation to collaborators Nov 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.InteropServices source-generator Indicates an issue with a source generator feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants