Skip to content

Instantly share code, notes, and snippets.

@arturkula
Last active February 18, 2025 17:03
Show Gist options
  • Select an option

  • Save arturkula/9746746fb38214c0fdf8d9e43f627a54 to your computer and use it in GitHub Desktop.

Select an option

Save arturkula/9746746fb38214c0fdf8d9e43f627a54 to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
namespace Helpers;
public static class PerformanceHelper
{
public static TimeSpan MeasureExecution(Action action)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
action();
stopwatch.Stop();
return stopwatch.Elapsed;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment