Sunday, July 29, 2018

2018 15" MacBook Pro SSD Benchmark - macOS, Bootcamp and Windows on VMWare Fusion

Hardware:

  • 2018 15 inch MacBook Pro, 2.6 GHz Intel Core i7,  Radeon 560X, 16 GB DDR4 RAM, 512 GB SSD

Software:

  • macOS High Sierra 10.13.6 (with July update addressing throttling issue), APFS + encryption
  • Bootcamp, Windows 10 Pro x64 Fall Creators Update, NTFS
  • VMWare Fusion 10.1.1, Windows 10 Pro x86 guest OS, NTFS

Friday, July 27, 2018

Non-cached/non-buffered File Operations (System.IO.FileSteam) with .NET Core on Windows and Mac - Creating Cross-platform Disk Benchmark App

If you have the question of executing disc reads/writes directly against the device and avoid file cache of the OS you're welcome to continue reading this post.

Intro

Assume you're creating a disk benchmark app you want to execute on Windows and macOS (and might be any other platform) and in your .NET Core project come up with a solution similar to the below C# code snippet:

var sw = new Stopwatch();
var file = new FileStream("C:\\testfile.dat", FileMode.CreateNew);
var buffer = new byte[1024 * 1024 * 1024];
var rand = new Random();
rand.NextBytes(buffer);

sw.Restart();
file.Write(buffer, 0, blockSize);
file.Flush();
sw.Stop();

- you create a file a get an instance of FileStream, write a randomized byte array to it and measure the time it took to complete the write.