بازنویسی کامل FileStream در دات نت 6 جهت بهبود کارآیی آن
نویسنده: وحید نصیری
تاریخ: ۱۴۰۰/۰۲/۲۸ ۱۰:۵۶
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
In this particular example (Windows 10 with SSD drive with BitLocker enabled) reading 1 MB file is now 2.5 times faster, while writing is 5.5 times faster.
The memory allocations dropped from 39 kilobytes to 192 bytes! This is a 99.5% improvement!
| Method | Runtime | Mean | Ratio | Allocated |
|---|---|---|---|---|
| ReadAsync | .NET 5.0 | 3.419 ms | 1.00 | 39,504 B |
| ReadAsync | .NET 6.0 | 1.445 ms | 0.42 | 192 B |
| | | | | |
| WriteAsync | .NET 5.0 | 12.181 ms | 1.00 | 39,192 B |
| WriteAsync | .NET 6.0 | 2.193 ms | 0.18 | 192 B |