PerformanceBenchmark 1.0.5

dotnet add package PerformanceBenchmark --version 1.0.5
                    
NuGet\Install-Package PerformanceBenchmark -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PerformanceBenchmark" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PerformanceBenchmark" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="PerformanceBenchmark" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PerformanceBenchmark --version 1.0.5
                    
#r "nuget: PerformanceBenchmark, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PerformanceBenchmark@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PerformanceBenchmark&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=PerformanceBenchmark&version=1.0.5
                    
Install as a Cake Tool

Class and Method Profiler

The Class and Method Profiler is a utility class that allows you to profile the performance of a specific method in your C# application. It measures the execution time of the method and logs the results for analysis. This can be helpful in identifying performance bottlenecks and optimizing your code.

Installation

Install it as Nuget package

Usage

To use the Profile method, follow these steps:

  1. Include the PerformanceBenchmark namespaces in your code file:

using PerformanceBenchmark;


Example:

public static void Main(string[] args)
        {
            var q = new Queue<int>();
            int iterations = Int32.MaxValue / 2;
            int i = int.MinValue;

            i = int.MinValue;
            Profile("original queue push", iterations, () =>
            {
                q.Enqueue(i);
                q.Dequeue();
            });
        }

2. Call the `Profile` method, providing the necessary parameters:

Profile("Description of the method being profiled", numberOfIterations, MethodToProfile);
  • Description: A string that describes the purpose or nature of the method being profiled.
  • numberOfIterations: An integer specifying the number of times the method should be executed for profiling.
  • MethodToProfile: A delegate representing the method to be profiled. It should have a compatible signature with the Action delegate.
  1. Review the logged results:

The Profile method logs the execution time for each iteration of the method being profiled. The logged information is stored in a file named "log.txt".

To view the profiling results, open the "log.txt" file using a text editor or any associated application capable of displaying text files.

Contributing

Contributions to the Class and Method Profiler are welcome! If you encounter any issues, have suggestions for improvements, or want to contribute new features, please follow these steps:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/your-feature.
  3. Make your changes and commit them: git commit -m 'Add some feature'.
  4. Push to the original branch: git push origin feature/your-feature.
  5. Create a pull request.

Please ensure that your contributions align with the project's coding style and conventions.

License

Feel free to modify and adapt the Class and Method Profiler to suit your needs.


Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 256 6/19/2023
1.0.4 207 6/19/2023
1.0.3 203 6/19/2023