When measuring execution speed or building high-frequency applications in C#, developers frequently rely on System.Diagnostics.Stopwatch. Historically, however, the Stopwatch.IsHighResolution property raised concerns: if a system lacked hardware support, the class would fall back to low-resolution system timers (~15.6 ms resolution on Windows).

With modern .NET (.NET Core, .NET 6, 7, 8, and 9) running on Linux, macOS, Windows, and ARM devices, is lower precision timer fallback still a real concern for cross-platform applications?

The Short Answer

For almost all modern hardware and operating systems, Stopwatch.IsHighResolution is always true. Modern x86, x64, and ARM processors feature built-in high-precision hardware timers (such as TSC or generic ARM timers), and all supported desktop, server, and mobile operating systems utilize them.

You do not need to worry about falling back to 15-millisecond DateTime precision on modern operating systems.

How Stopwatch Works Across Operating Systems

.NET maps Stopwatch calls to high-resolution native OS primitives depending on the target platform:

  • Windows: Calls QueryPerformanceCounter (QPC), which leverages hardware timers like TSC (Time Stamp Counter) or HPET. Resolution is typically in the sub-microsecond or nanosecond range.
  • Linux: Calls clock_gettime using CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW, providing nanosecond-level resolution.
  • macOS / iOS: Uses mach_absolute_time() or clock_gettime, delivering sub-microsecond precision.

Edge Cases: When Might It Not Be High Resolution?

While high-precision timing is the default today, there are a few rare scenarios where you might encounter limitations:

  • WebAssembly (Wasm / Blazor Client-Side): In browser environments, high-resolution timers may be intentionally degraded or coarsened (e.g., rounded to 5 microseconds or 100 microseconds) by browser vendors to mitigate side-channel timing attacks such as Spectre.
  • Obsolete or Niche Hardware: Embedded Linux platforms running on legacy CPUs without hardware counter support may report lower resolution.
  • Virtual Machine Time Drift: Extremely old hypervisors with poor hardware clock virtualization might suffer from clock drift, though modern hypervisors (Hyper-V, ESXi, KVM) virtualize invariant TSC reliably.

Best Practices for Modern .NET High-Precision Timing

In modern .NET (.NET 7+), creating new Stopwatch class instances incurs unnecessary heap allocations. The recommended approach for zero-allocation performance measurement is using Stopwatch.GetTimestamp() and Stopwatch.GetElapsedTime().