Copy-on-Write in Win32 API Early Access

Find out about the potential gains of automatic Copy-on-Write linking that's part of the early preview in Windows 11 Insider Canary.

Erik Mavrinac
2 min readintermediate
--
View Original

Overview

The article discusses the early preview of copy-on-write (CoW) linking in the Win32 API, released by the Windows filesystem team. It highlights the performance improvements achieved through CoW linking, particularly in reducing build times for .NET applications using the new Dev Drive feature.

What You'll Learn

1

How to leverage copy-on-write linking in Win32 API for improved performance

2

Why using Dev Drive can enhance build efficiency for large C# repositories

3

When to adopt early preview features for performance benchmarking

Key Questions Answered

What is copy-on-write linking in Win32 API?
Copy-on-write linking in Win32 API is a feature that allows for more efficient file operations by linking files in a way that avoids unnecessary copying until modifications are made. This feature is integrated into the CopyFile APIs when using Dev Drive or ReFS, improving performance for developers.
How much did build times improve with copy-on-write linking?
In testing a large C# repository, moving to Dev Drive resulted in a 32% reduction in build time. With the addition of copy-on-write linking, this improvement increased to 42%, showcasing significant performance gains for developers.
When will copy-on-write linking be available in Windows?
Copy-on-write linking is expected to ship as part of Windows Server 2025 and Windows 11 in the second half of 2024. Preview versions currently have this feature enabled by default for early testing.
What are the benefits of using Dev Drive for builds?
Using Dev Drive for builds provides substantial performance improvements, including a 32% reduction in build time for large C# repositories. This is further enhanced by the integration of copy-on-write linking, which can lead to a total reduction of 42% in build times.

Key Statistics & Figures

Reduction in build time
32%
Achieved by moving to Dev Drive for a large C# repository.
Total reduction in build time with CoW linking
42%
This is the total improvement after implementing copy-on-write linking.

Technologies & Tools

Backend
Win32 API
Used for implementing copy-on-write linking in file operations.
Tools
Dev Drive
Provides an optimized environment for developers to leverage copy-on-write linking.
Filesystem
Refs
Supports the implementation of copy-on-write linking in file operations.

Key Actionable Insights

1
Join the Windows 11 Insider Canary channel to test the early preview of copy-on-write linking.
This allows developers to benchmark their workloads and experience the performance gains firsthand, particularly for builds that involve a lot of file copying.
2
Utilize Dev Drive to achieve significant reductions in build times.
By moving to Dev Drive, developers can leverage the built-in optimizations that come with copy-on-write linking, which can lead to improved efficiency in their development processes.
3
Monitor the release updates for copy-on-write linking in Windows 11 and Windows Server 2025.
Staying informed about these updates will help developers prepare for the upcoming features that can enhance their development environments.

Common Pitfalls

1
Failing to test the early preview features before they are officially released.
This can lead to missed opportunities for performance improvements that could significantly enhance build times and overall development efficiency.