How Microsoft's DirectStorage 1.2 Update Can Speed Up Your Crusty Old Hard Drive
by
Zak Killian
—
Thursday, April 20, 2023, 01:14 PM EDT
Most of the discussion around Microsoft's DirectStorage API has been centered around games and how it can drastically reduce their load times when paired with fast NVMe SSDs. DirectStorage as an API actually works on any kind of storage device, though, and it offers reduced overhead even on old spinning rust. However, getting the best performance from both SSDs and HDDs required separate code paths for each type of device.
DirectStorage 1.2 is now available, and one of the key changes in this revision is that developers can configure a setting which enables—indeed, forces—the use of buffered accesses, which can help mask relatively-long hard drive seek times. This allows developers to simply toggle on this setting when loading from a hard drive instead of having to write an entire second codepath for disk accesses.
However, the "ForceFileBuffering" setting in DirectStorage is exclusive with the BypassIO feature. BypassIO is one of the key features in DirectStorage that allows the application to skip most of Windows' extensive storage stack and access the raw data coming from the SSD, drastically reducing disk access overhead. This overhead is infinitesimal compared to the access latency of hard drives, but it rapidly becomes a factor with fast NVMe SSDs. As a result, developers will want to be careful with this setting, as it is not suitable for use with SSDs.
Aside from the file buffering toggle, there's also a new API that developers can use to query the DirectStorage driver and find out exactly what path it is using for file decompression. Frankly, it's kind of incredible that this didn't already exist, but now, developers can ask the driver whether it is performing GPU-optimized or CPU-based fallback for asset decompression, as well as what types of queues it is using.
This new release also has a minor optimization as well as a few bug fixes. The optimization moves a post-decompression copy operation into the compute queue on GPUs for which this makes sense, while the bugfixes are detailed in Microsoft's blog post as well as the NuGet repository, which you can check out over here.
Unfortunately, DirectStorage hasn't found wide adoption yet, with the only PC game supporting it to date being the unpopular Forspoken. That's possibly because developers feel it isn't worth the hassle of implementing it. After all, a wide majority of PC gamers probably still host their game data on hard drives, and the Xbox Series consoles (which support a form of DirectStorage) haven't exactly blown up the market. Here's hoping DirectStorage becomes more popular, as we'd very much like for load times to be a thing of the past.